Question

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

Was it helpful?

Solution

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

    <CallTarget Targets="GenerateDocumentation"></CallTarget>
  </Target>   
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top