Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get MSBuild Task to generate XML Documents when building a solution?

I have a solution with lots of projects. Each project is configured to generate the XML documentation file when building in Debug-Mode (which is default). That works when I build in Visual Studio 2008. In my build script on my integration server I advise MSBuild to build the whole solution, but it won't generate the documentation files. What can I do?

I already tried to explicitly give the Debug-Condition to the build process, but it makes no difference.

<Target Name="BuilSolution">
     <MSBuild Projects="C:\Path\To\MySolution.sln" targets="Build" Properties="SolutionConfigurationPlatforms='Debug|Any CPU'"/>
</Target>    

There seem to be some ideas to solve this problem when building single projects, but I can't afford to do this, so I need a hint for doing it this way.

Thanks in advance!

like image 835
toba303 Avatar asked Apr 14 '10 17:04

toba303


People also ask

How does MSBuild create solution?

To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.

Which is the initial step needed when using the MSBuild at the command prompt?

Build the targettargets file. Run MSBuild from the Developer Command Prompt for Visual Studio to build the HelloWorld target defined above. Use the -target or -t command-line switch to select the target.

How do I run MSBuild from command prompt?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.


1 Answers

In VS 2010, you can either do this in C# project properties, or you can define a DocumentationFile property in your .csproj file. For example:

<PropertyGroup>
  ...
  <DocumentationFile>$(OutputPath)MyAssembly.xml</DocumentationFile>
</PropertyGroup>

The MSBuild code in $(MSBuildToolsPath)\Microsoft.CSharp.targets will condition on that property being defined - if it is, your XML Comments file will be created.

like image 172
crimbo Avatar answered Sep 28 '22 10:09

crimbo