在构建解决方案时,如何让MSBuild任务生成XML文档?

时间:2022-09-02 02:14:18

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?

我有很多项目的解决方案。在以调试模式(默认)构建时,每个项目都被配置为生成XML文档文件。当我在Visual Studio 2008中构建时,这是可行的。在集成服务器上的构建脚本中,我建议MSBuild构建整个解决方案,但它不会生成文档文件。我能做什么?

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!

提前谢谢!

4 个解决方案

#1


3  

I do this all the time with my CI server. Just pass properties as follows:

我在CI服务器上一直这样做。只传递如下属性:

Properties="Configuration=Debug;Platform=Any CPU"

配置属性= " =调试;平台=任何CPU”

#2


5  

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:

在VS 2010中,您可以在c#项目属性中执行此操作,也可以在.csproj文件中定义一个DocumentationFile属性。例如:

<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.

MSBuild工具spath)\Microsoft.CSharp中的MSBuild代码。目标将根据所定义的属性进行设置——如果是,将创建XML注释文件。

#3


2  

Project properties are different for each configuration. In your project properties you have enabled XML document only for the debug config. Switch to the release config and enable it for that one too.

每个配置的项目属性是不同的。在项目属性中,您只为调试配置启用了XML文档。切换到release配置并启用它。

#4


0  

Wild guess - the only thing I can see that might help is to set the GenerateDocumentation parameter in your build script.

我能看到的唯一有用的东西是在构建脚本中设置GenerateDocumentation参数。

To quote from a bit of MSDN (that references .NET 4, so I'm not certain that this is applicable): GenerateDocumentation A boolean parameter that indicates whether documentation is generated by the build. If true, the build generates documentation information and puts it in an .xml file together with the name of the executable file or library that the build task created.

引用一些MSDN(引用。net 4,所以我不确定这是否适用):GenerateDocumentation一个布尔参数,它指示文档是否由构建生成。如果是,构建生成文档信息,并将其与构建任务创建的可执行文件或库的名称放在.xml文件中。

#1


3  

I do this all the time with my CI server. Just pass properties as follows:

我在CI服务器上一直这样做。只传递如下属性:

Properties="Configuration=Debug;Platform=Any CPU"

配置属性= " =调试;平台=任何CPU”

#2


5  

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:

在VS 2010中,您可以在c#项目属性中执行此操作,也可以在.csproj文件中定义一个DocumentationFile属性。例如:

<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.

MSBuild工具spath)\Microsoft.CSharp中的MSBuild代码。目标将根据所定义的属性进行设置——如果是,将创建XML注释文件。

#3


2  

Project properties are different for each configuration. In your project properties you have enabled XML document only for the debug config. Switch to the release config and enable it for that one too.

每个配置的项目属性是不同的。在项目属性中,您只为调试配置启用了XML文档。切换到release配置并启用它。

#4


0  

Wild guess - the only thing I can see that might help is to set the GenerateDocumentation parameter in your build script.

我能看到的唯一有用的东西是在构建脚本中设置GenerateDocumentation参数。

To quote from a bit of MSDN (that references .NET 4, so I'm not certain that this is applicable): GenerateDocumentation A boolean parameter that indicates whether documentation is generated by the build. If true, the build generates documentation information and puts it in an .xml file together with the name of the executable file or library that the build task created.

引用一些MSDN(引用。net 4,所以我不确定这是否适用):GenerateDocumentation一个布尔参数,它指示文档是否由构建生成。如果是,构建生成文档信息,并将其与构建任务创建的可执行文件或库的名称放在.xml文件中。