Tfs2010 Build number and mounting versions of files and MSBuild targets

I read an article by John Robbins TFS 2010 Build Number and assembly file versions: it is fully synchronized only with MSBuild 4.0 , and I'm wondering about how best to integrate this.

The download for an article has two files, one is a targets file, and one is a proj file.

There are several tasks in the goals file to clear the build number based on the Tfs build number (the same one used for the build), and write that number to some place (name it BuildNumberFile) for consumption by other proj files.

The proj file is very simple. It simply imports the aforementioned goal file, and then declares the goal with the name โ€œEveryoneโ€, and also declares DefaultTargets in the Project element to everyone as well.

    <Project ToolsVersion="4.0" DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
            <!-- The two required properties so the Wintellect.TFSBuildNumber tasks knows your major and minor values.-->
            <TFSMajorBuildNumber>3</TFSMajorBuildNumber>
            <TFSMinorBuildNumber>1</TFSMinorBuildNumber>
        </PropertyGroup>

        <Import Project="Wintellect.TFSBuildNumber.targets"/>

        <!-- Just ask for the version information files you need. These are here to show all the diffent ones in 
           Wintellect.TFSBuildNumber.Targets. You can change the names -->
        <Target Name="All"
              DependsOnTargets="WriteSharedCSharpAssemblyVersionFile;
                              WriteSharedVBAssemblyVersionFile;
                              WriteSharedCPPCLIAssemblyVersionFile;
                              WriteSharedCPPAssemblyVersionFile;
                              WriteSharedWiXAssemblyVersionFile;
                              WriteSharedTextAssemblyVersionFile;"/>
    </Project>

I have two questions:

  • MSBuild. , ? , ?
  • , csproj Include BuildNumberFile, compiletime?
  • DependsOnTargets -, , ?
  • csproj, , , DependsOnTargets BuildNumberFile?

!

+3
1

, , , :

  • , . Microsoft.Common.targets - BeforeBuild AfterBuild - . , <Target Name="BeforeBuild" DependsOnTargets="WriteSharedCSharpAssemblyVersionFile" />, WriteSharedCSharpAssemblyVersionFile , . , MSBuild, BeforeBuild โ€‹โ€‹ Microsoft.CSharp.targets, csproj .

  • WriteSharedCSharpAssemblyVersionFile - , . , , , (, , ), BeforeBuild, .

    • , . , , . , , , .
  • MSBuild ( ), . . , .

  • - , , - Wintellect.TFSBuildNumber.targets csproj BeforeBuild WriteSharedCSharpAssemblyVersionFile .

, !

+1

Source: https://habr.com/ru/post/1767633/


All Articles