Reputation: 819
I am trying to make the following build scenario in my environment (using Jenkins and git) on my .net projects which are all under abc solution:
[assembly: AssemblyVersion("1.2.3.4")] [assembly: AssemblyFileVersion("1.2.3.4")]
Any idea on a nice way for doing step 3 and 4 ? I tried to run this command line but it did not gave me the result I wanted.
msbuild.exe abc.sln /p:Configuration=Release;VersionAssembly=1.2.3.4
Appreciate your kindly answers. Thanks
Upvotes: 4
Views: 4239
Reputation: 11563
Use MSBuild.Community.Tasks
and add the following to the *.csproj
project files:
<Import Project=".\tasks\MSBuild.Community.Tasks.Targets"/>
<AssemblyInfo CodeLanguage="CS"
OutputFile="AssemblyInfo.cs"
AssemblyVersion="$(BUILD_NUMBER)"
AssemblyFileVersion="$(BUILD_NUMBER)" />
Run msbuild
and pass the desired build number as a parameter:
msbuild abc.sln /p:BUILD_NUMBER=1.2.3.4
Upvotes: 3