First you need to ensure you have installed the open source project MSBuild Community Tasks, downloadable from here.
Then the code to do this is:
<Target Name="PreBuildTasks">
<PropertyGroup>
<Version>$(BUILD_NUMBER)</Version>
</PropertyGroup>
<MSBuild.Community.Tasks.AssemblyInfo
CodeLanguage="CS"
AssemblyCompany="CompanyName"
AssemblyCopyright="Copyright (c) CompanyName2009"
AssemblyDescription="Description"
AssemblyFileVersion="$(Version)"
AssemblyVersion="$(Version)"
AssemblyTitle="Titlek"
Guid="1938930d-a5f3-4045-a5f3-f5b930d70ade"
AssemblyProduct="Product name"
OutputFile="$(MSBuildProjectDirectory)\ProjectName\Properties\AssemblyInfo.cs" />
</Target>
Please note this has only be tested to work on TeamCity.
No comments:
Post a Comment