I am building an UWP app and I want to have generated package to be named with the build number in order to distinguish the builds. So far, I have this configuration in the csproj file:
<Target Name="BeforeBuild">
<Message Text="Updating AssemblyInfo to Version $(VersionNumber)"></Message>
<Message Text="Writing to AssemblyInfo files in $(SolutionRoot)"></Message>
<AssemblyInfo CodeLanguage="CS"
AssemblyCompany="Company"
AssemblyProduct="Product"
AssemblyCopyright="Copyright © Company 2011"
ComVisible="true"
AssemblyVersion="$(BUILD_NUMBER)"
AssemblyFileVersion="$(BUILD_NUMBER)" />
</Target>
All good, I can run the msbuild with the /p:BUILD_NUMBER=1.2.3.4 argument, but this is only reflecting in AssemblyInfo.cs file.
The .appx file will be named as MyApplication.Core_1.0.0.0_x86_Test.appx and not MyApplication.Core_1.2.3.4_x86_Test.appx
How can I use the BUILD_NUMBER information to be reflected in the .appx file name?
The version number in .appx file name is not set by
AssemblyInfo. This version number is called Package version number which is set as a value in the Version attribute of the Package/Identity element in the app manifest like:Once you changed the Version attribute and then run MSBuild, you will get the .appx file named like
MyUWPApp_1.2.3.0_x86.appx.Besides this, we usually change the package version number while creating an app package. This can be done with Microsoft Visual Studio wizard like following:
(source: s-msft.com)