Msbuild and file version change

I am trying to make the following build script in my environment (using Jenkins and git) in my .net projects that are all under abc control:

  • Check out the changes from git.
  • Build a solution in which only those projects that have been updated, pull tricks, and dependencies will be created.
  • The build team should build these projects and their dependencies with a specific build version. e.g. 1.2.3.4
  • Each assembly of info.cs projects that have been created must be changed to
[assembly: AssemblyVersion("1.2.3.4")]
[assembly: AssemblyFileVersion("1.2.3.4")]

Any idea with a good way to complete steps 3 and 4? I tried to run this command line, but it did not give me the result I wanted.

msbuild.exe abc.sln /p:Configuration=Release;VersionAssembly=1.2.3.4

Appreciate your kind answers. Thanks

+4
1

MSBuild.Community.Tasks *.csproj:

<Import Project=".\tasks\MSBuild.Community.Tasks.Targets"/>

<AssemblyInfo CodeLanguage="CS"  
    OutputFile="AssemblyInfo.cs" 
    AssemblyVersion="$(BUILD_NUMBER)" 
    AssemblyFileVersion="$(BUILD_NUMBER)" />

msbuild :

msbuild abc.sln /p:BUILD_NUMBER=1.2.3.4
+1

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


All Articles