msbuild not working properly with tfs 2010 and importet Microsoft.TeamFoundation.Build.targets

烈酒焚心 提交于 2019-12-13 01:18:16

问题


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"/>

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>

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?

Thanks in advance...


回答1:


what about adding this at the end of your build task...

    <CallTarget Targets="GenerateDocumentation"></CallTarget>
  </Target>   


来源:https://stackoverflow.com/questions/10226997/msbuild-not-working-properly-with-tfs-2010-and-importet-microsoft-teamfoundation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!