I have a solution with Asp.NET Core project, and a WiX Project that generates an MSI to deploy it to an IIS Server.
Currently whenever we build the project we have to update build numbers in the following locations:
I want to minimize the number of individual edits required to update the version. Ideally I'd only like to have to set versions on Asp.NET Project Properties Page, and Wix automatically reflect the change.
Based on related answers I was able to get the WiX version to get set automatically by binding it to the AssemblyFileVersion. However there are two issues with that solution. You end up with 4 digit version number for MSI, and god knows what will end up choking on that in the future. Another issue is that I don't want to tie my MSI version to dll version (there may be a case where the package is updated by dll is not).
That's why I'm looking for a way to automatically set WiX version to the package version from Asp.NET properties page. It solves the two issues above, as that version number can be set to 3 digits, and it is also not tied to dll file versions. How do I go about it? The package version is stored inside Asp.NET csproj file as following (it's the 1.0.2 tag):
<PropertyGroup>
...
<Version>1.0.2</Version>
<AssemblyVersion>1.0.0.2</AssemblyVersion>
<FileVersion>1.0.0.2</FileVersion>
<Company>My Company</Company>
<Product>My Product</Product>
<Authors>My Company</Authors>
</PropertyGroup>
How can I set attribute inside wxs project file to that value during build? I'll even go with hack solutions at this point, because it doesn't look like there's a standard way of doing it.
I ended up writing a Powershell script that uses regex to scan relevant files for lines with versions in them and replaces the text with the new version. It's a simple solution that ends up working for all types of project files (AssemblyInfo.cs, Product.wxs, .vdproj, .csproj, package.json, .aip, etc.), since all you're doing is manipulating text files. To figure out which lines you want to replace, just modify the version using UI and check the change history using git for example.