Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBUILD build a project WITH the XML documentation files

Tags:

msbuild

This should be easy, but I can't get it to work.

I have a web project, that references another project in my solution (lets call it Project1). Both projects are set to create XML documentation files.

When I right click the web project and build in Visual studio, my web/bin folder contains the XML doc files for both the web project and Project1.

I want exactly the same behavior in MSBUILD, so when I build I get both XML files in the bin folder, but I can't get it to play ball - what happens is that the XML file for the web project is created, but not for project1.

I've tried

  • MSBUILD the solution
  • MSBUILD the web project
  • /p:GenerateDocumentation=true doesn't work (on the solution or the web proj)

Help!

like image 368
Matt Roberts Avatar asked Jul 24 '15 09:07

Matt Roberts


People also ask

What is MSBuild XML?

The Microsoft Build Engine is a platform for building applications. This engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software. Visual Studio uses MSBuild, but MSBuild doesn't depend on Visual Studio.

How do I build with MSBuild?

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.

What is MSBuild project file?

NET Framework use MSBuild project files to describe and control the application build process. When you use Visual Studio to create an MSBuild project file, the appropriate XML is added to the file automatically.

What is the difference between MSBuild and Visual Studio build?

Visual Studio determines the build order and calls into MSBuild separately (as needed), all completely under Visual Studio's control. Another difference arises when MSBuild is invoked with a solution file, MSBuild parses the solution file, creates a standard XML input file, evaluates it, and executes it as a project.


2 Answers

Gah. I got it.

I was specifying the Configuration (/p:Configuration=Release) but not a platform (/p:Platform="Any CPU"). So, it was choosing the x64 platform which is a platform I'd not ticked build XML documentation for.

TLD: Make sure you specify the configuration and the platform for the solution, and the XML docs will be created!

like image 110
Matt Roberts Avatar answered Nov 27 '22 02:11

Matt Roberts


On my end the XML was generated when building locally in VS, but NOT using MSBuild Task on TFS / Azure DevOps.

The "magic" part is to specify the p:/DocumentationFile parameter. In my working scenario it is: /p:DocumentationFile="$(ApplicationName).xml"

Thus the file comes out to the output directory along with project dlls.

like image 41
Vladimír Hála Avatar answered Nov 27 '22 00:11

Vladimír Hála