Reputation: 1447
I am not pretty familiar with msbuild technique. Currently I have a build.proj in my solution to assign a build number to the exe, by using a following param:
<PropertyGroup Condition=" '$(BUILD_NUMBER)' != '' ">
<!-- Build Server Number -->
<Version>$(BUILD_NUMBER)Version>
<FileVersion>$(BUILD_NUMBER)FileVersion>
<InformationalVersion>$(BUILD_NUMBER)InformationalVersion></PropertyGroup><Target Name="Version">
<Attrib Files="$(MSBuildProjectDirectory)\AssemblyInfo.cs" ReadOnly="False" />
<AssemblyInfo CodeLanguage="CS"
OutputFile="$(MSBuildProjectDirectory)\GlobalAssemblyInfo.cs"
GenerateClass="true"
AssemblyCopyright="Copyright © $(Year). All rights reserved."
AssemblyConfiguration="$(BuildConfiguration)"
AssemblyVersion="$(Version)"
AssemblyFileVersion="$(FileVersion)"
AssemblyInformationalVersion="$(InformationalVersion)" /> </Target>
Now I can't use build.proj. Is it any alternative way to assign a build number to csproj?
Upvotes: 1
Views: 265
Reputation: 157038
We generate a AssemblyInfo.cs
file to put in all assembly attributes we need to define. You could do this on pre-build time if that suits you. There we define the AssemblyVersion
, AssemblyFileVersion
attribute and other related attributes.
Those properties will be used compiling the assembly.
Upvotes: 2