Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 22.214.171.124
The primary use of the AssemblyInfo task is to set assembly version numbers at build time. The typical way to use it is to add the MSBuild.ExtensionPack.VersionNumber.Targets file to your project file, and to then specify properties in your project file to control the assembly version numbers.
Version numbers are of the form A.B.C.D, where:
- A is the major version
- B is the minor version
- C is the build number
- D is the revision
Typically the major and minor versions are fixed and do not change over the course of multiple daily builds. The build number is frequently set to increment on a daily basis, either starting at 1 and continuing from there, or as some representation of the date of the build. The revision is typically used to differentiate between multiple builds on the same day, usually starting at 1 and incrementing for each build.
To get the standard Visual Studio-style version simply add the MSBuild.ExtensionPack.VersionNumber.Targets file to your project. To override the default version numbers, such as the major and minor version, you can set the appropriate properties. For more information see the AssemblyMajorVersion and AssemblyMinorVersion items.For use with Team Foundation Server, see this blog post: Team Build and the AssemblyInfo TaskHow To: Auto-Increment Version Numbers for a Project The most common way to use the AssemblyInfo task is to add a reference to the MSBuild.ExtensionPack.VersionNumber.targets file to any project file whose AssemblyInfo you want to manage. For standard .csproj, .vbproj, and .vjsproj files do the following: Open the project in Visual Studio 2005 Right-click on the project in Solution Explorer and select Unload Project Right-click on the project in Solution Explorer and select Edit [project file] If the AssemblyInfoTask was installed into the Global Assembly Cache add the following line at the end of the project file after the last <Import> tag: <Import Project="$(MSBuildExtensionsPath)\Microsoft\ExtensionPack\MSBuild.ExtensionPack.VersionNumber.targets"/> If the AssemblyInfoTask was installed into the user's Application Data folder add the following line at the end of the project file after the last <Import> tag: <Import Project="$(APPDATA)\Microsoft\MSBuild\ExtensionPack\MSBuild.ExtensionPack.VersionNumber.targets"/> Save and close the project file Right-click on the project in Solution Explorer and select Reload Project With these project file modifications all builds will have auto-incrementing assembly and file versions of the following format: 1.0.date.revision For example, the first build on November 10th, 2005 will have a version number of: 1.0.51110.00 Subsequent builds on the same day will have version numbers 1.0.51110.01, 1.0.51110.02, and so on. Note: All AssemblyInfo.* files must have have entries with a starting value of "126.96.36.199" for AssemblyVersion and AssemblyFileVersion so the AssemblyInfoTask will work correctly. If these entries are missing from the files a build error will be generated. Overriding the Default Version Number Behaviour In some situations the desired version number behaviour may be different than the defaults offered by the MSBuild.ExtensionPack.VersionNumber.targets file. To set the assembly and file versions to specific numbers add the appropriate property to your project file. For example, to set the major version to 8, add the following two properties: <AssemblyMajorVersion>8</AssemblyMajorVersion> <AssemblyFileMajorVersion>8</AssemblyFileMajorVersion> For more information see the assembly version properties reference.
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath> <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath> </PropertyGroup> <Import Project="$(TPath)"/> <Target Name="Default"> <ItemGroup> <AssemblyInfoFiles Include="C:\a\CommonAssemblyInfo.cs"/> <AssemblyInfoFiles1 Include="C:\a\CommonAssemblyInfo1.cs"/> <AssemblyInfoFiles2 Include="C:\a\CommonAssemblyInfo2.cs"/> </ItemGroup> <!-- Update an attribute and don't do any versioning --> <MSBuild.ExtensionPack.Framework.AssemblyInfo ComVisible="true" AssemblyInfoFiles="@(AssemblyInfoFiles)" SkipVersioning="true"/> <!-- Version using YearWeekDay and set the start of the week as a Sunday --> <MSBuild.ExtensionPack.Framework.AssemblyInfo AssemblyInfoFiles="@(AssemblyInfoFiles1)" AssemblyBuildNumberType="YearWeekDay" FirstDayOfWeek="Sunday"/> <!-- Version using the number of days elapsed since a given start date--> <MSBuild.ExtensionPack.Framework.AssemblyInfo AssemblyInfoFiles="@(AssemblyInfoFiles2)" StartDate="1 Jan 1976" AssemblyBuildNumberType="ElapsedDays"/> </Target> </Project>