msbuild无法与tfs 2010和importet Microsoft.TeamFoundation.Build.targets一起正常使用 [英] msbuild not working properly with tfs 2010 and importet Microsoft.TeamFoundation.Build.targets
问题描述
我对扩展我的msbuild项目文件和tfs 2010感到困惑.我想要实现的是在构建后自动为我的源代码生成文档.我在网上搜索后发现,文件Microsoft.TeamFoundation.Build.targets为桌面或团队构建定义了许多可自定义的目标.其中之一是我要使用的GenerateDocumentation
-Target.我遇到的问题是,尽管我导入了此文件,但msbuild不会调用重载的目标.我的vcxproj-File的标题如下:
i'm stuck with extending my msbuild project file and tfs 2010. What i want to achieve is to automatically generate the documentation for my source code after the build. I searched the web and found out, that the file Microsoft.TeamFoundation.Build.targets defines a lot of customizable targets for either desktop- or team-build. One of them is the GenerateDocumentation
-Target which i want to use. The Problem i have is, that despite i imported this file, the overloaded targets are not invoked by msbuild. The header of my vcxproj-File looks as follows:
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
在此之后,我将团队建设目标文件包含在声明中
after this i include the team build targets file with the statement
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets"/>
在此项目文件的最后,我试图按照TeamFoundation目标文件中的建议重载一些目标:
At the very end of this project file i tried to overload some targets as suggested in the TeamFoundation target file:
<Target Name="GenerateDocumentation">
<Message Text="GenerateDocumentation invoked" Importance="high"/>
</Target>
<Target Name="BeforeBuild">
<Message Text="BeforeBuild invoked" Importance="high" />
</Target>
<Target Name="AfterBuild">
<Message Text="AfterBuild invoked" Importance="high" />
</Target>
,但除了AfterBuild
-Target以外,对于本地构建或使用构建服务器的构建都不会调用GenerateDocumentation
和BeforeBuild
目标.我想念什么吗? DefaultTarget="Build"
是否正确?我试图将其更改为DefaultTarget="DesktopBuild"
,但随后调用msbuild
会导致各种错误(MSB4018).在项目文件中,也导入了目标文件$(VCTargetsPath)\Microsoft.Cpp.targets
.删除此导入时,将调用GenerateDocumentation
目标,但不会调用其他目标(包括我也需要的ResourceCompile
).我可以以某种方式使用它们吗?
but except the AfterBuild
-Target neither the GenerateDocumentation
nor BeforeBuild
target is called for a local build nor a build with the build server. Am i'm missing something? Is the DefaultTarget="Build"
correct? I tried to change this to DefaultTarget="DesktopBuild"
but then calling msbuild
resulted in a variety of errors (MSB4018). In the project file the target file $(VCTargetsPath)\Microsoft.Cpp.targets
is imported too. When removing this import, the GenerateDocumentation
target is called, but not the other ones (including ResourceCompile
which i need too). Can i use both of them somehow?
预先感谢...
推荐答案
在构建任务结束时添加此内容的原因...
what about adding this at the end of your build task...
<CallTarget Targets="GenerateDocumentation"></CallTarget>
</Target>
这篇关于msbuild无法与tfs 2010和importet Microsoft.TeamFoundation.Build.targets一起正常使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!