MSBuild targets for updating Assembly version during build process.
AssemblyInfo can be set by initializing MSBuild property $(AssemblyVersionNumber)
before MSBuild target AssemblyVersionUpdate
is called.
-
Initialize property
$(AssemblyVersionNumber)
from command line:msbuild.exe MySolution.sln /p:AssemblyVersionNumber=1.2.3.4
-
Initialize or update property
$(AssemblyVersionNumber)
declaratively in MSBuild project or a referenced .props file:<PropertyGroup> <AssemblyVersionNumber>1.2.3.4</AssemblyVersionNumber> </PropertyGroup>
-
Update property
$(AssemblyVersionNumber)
in a custom target:<Target Name="MyCustomUpdateAssemblyVersionNumber" BeforeTargets="AssemblyVersionUpdate"> <PropertyGroup> <AssemblyVersionNumber>1.2.3.4</AssemblyVersionNumber> </PropertyGroup> </Target>