开发者

What is System.Web.Razor.xml used for?

When you add MVC and Razor deployment dependencies I got a lot more assemblies than I expected. But I also get a load of XML files too. Namely:

  • Microsoft.Web.Infrastructure.xml
  • System.Web.Helpers.xml
  • System.Web.Razor.xml
  • S开发者_开发百科ystem.Web.WebPages.Deployment.xml
  • System.Web.WebPages.Razor.xml
  • WebMatrix.Data.xml
  • WebMatric.WebData.xml

What are these for? They don't seem to be necessary for a deployed ASP.NET MVC and Razor site to work but I'd like to know what they're for and why or if I actually do need them before I start telling people, "No, you definitely don't need them to run MVC 3 apps." Plus, I'm just interested.


These .xml files contain additional documentation metadata (such as class / method descriptions) that Visual Studio uses when displaying intellisense prompts.

They are not needed at all during build or runtime, and are only used when coding using the Visual Studio IDE.


Namespace.xml files are documentation files. It contains whichever three slash comments you have on classes, methods, properties, ...

You can create from your files, for that go on Project Settings > Build > XML Documentation File. It will extract /// comments from your code to generate the documentation.

Example:

/// <summary>
/// Crops image on the given Point and Size
/// </summary>
/// <param name="img">Current Image</param>
/// <param name="xy">Point X, Y</param>
/// <param name="wh">Size Width, Height</param>
/// <returns></returns>
public static Image Crop(this Image img, Point xy, Size wh)
{
    return img.Crop(new Rectangle(xy, wh));
}

Then if you send the DLL to someone they will not necessarily have the code, so they will not have this documentation and VS intelisense will not find any information about the method. With the XML file they can see the method information even without the code.

From MSDN:

  • Documentation tags
  • Processing the XML File
  • Delimiters for Documentation Tags
  • How to: Use the XML Documentation Features

To clarify these are not needed when deployed to you production servers.


It tells VS what to display in IntelliSense descriptions of things in the corresponding dll


They are supporting files for visual studio internal development. It helps in faster development by providing inline help during coding and referencing as required. They are an aid for Visual Studio.

You can remove them once development phase is over. They will not be needed on deployment!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜