构建解决方案时如何让 MSBuild 任务生成 XML 文档?
我有一个包含很多项目的解决方案。每个项目都配置为在调试模式(默认)下构建时生成 XML 文档文件。当我在 Visual Studio 2008 中构建时,这有效。 在我的集成服务器上的构建脚本中,我建议 MSBuild 构建整个解决方案,但它不会生成文档文件。我能做些什么?
我已经尝试显式地将调试条件赋予构建过程,但这没有什么区别。
<Target Name="BuilSolution">
<MSBuild Projects="C:\Path\To\MySolution.sln" targets="Build" Properties="SolutionConfigurationPlatforms='Debug|Any CPU'"/>
</Target>
在构建单个项目时似乎有一些想法可以解决这个问题,但我负担不起这样做,所以我需要一个提示来这样做。
提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 VS 2010 中,您可以在 C# 项目属性中执行此操作,也可以在 .csproj 文件中定义
DocumentationFile
属性。例如:$(MSBuildToolsPath)\Microsoft.CSharp.targets
中的 MSBuild 代码将以定义的该属性为条件 - 如果是,将创建 XML 注释文件。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: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.我一直在我的 CI 服务器上这样做。只需传递如下属性:
Properties="Configuration=Debug;Platform=Any CPU"
I do this all the time with my CI server. Just pass properties as follows:
Properties="Configuration=Debug;Platform=Any CPU"
每个配置的项目属性都不同。在您的项目属性中,您仅为调试配置启用了 XML 文档。切换到发布配置并为该配置启用它。
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.
疯狂猜测 - 我能看到的唯一可能有帮助的是在构建脚本中设置GenerateDocumentation参数。
引用 MSDN 的一些内容(引用 .NET 4,所以我不确定这是否适用):
生成文档
一个布尔参数,指示构建是否生成文档。如果为 true,则构建会生成文档信息并将其与构建任务创建的可执行文件或库的名称一起放入 .xml 文件中。
Wild guess - the only thing I can see that might help is to set the GenerateDocumentation parameter in your build script.
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.