This post discusses a way of linking the version number of an assembly (library, dll, executable) to the product version.
This is more suited to a library/framework, where you want to ensure that the product version is the same as the library/framework.
- On the library project, edit the AssemblyInfo.cs file:
- Create a new File called VersionInfo.cs on the Properties folder.
- Edit the project file (you'll need to unload the project if you want to do it from Visual Studio) and at the end, you'll find a commented out section. Get rid of it (everything between <!-- -->) and add the following:
- On the product.wxs file on your WiX project, just add the following:
- Finally, add the following to the wix project. Make sure this is on the initial PropertyGroup Element:
Remove these two lines:
Contents of file should be:
<Target Name="BeforeBuild"> < <WriteLinesToFile Condition=" '$(Version)' != '' " File="Properties\VersionInfo.cs" Overwrite="True" Lines="[assembly: System.Reflection.AssemblyVersion("$(Version)")] // Auto-generated by build process" /> </ </Target>
<Product Id="12c0deff-c0de-c0de-c0de-123f422c0dea" Name="Name" Language="1033" Version ="!(bind.FileVersion.filAB3D3C60ED5901936249D5C56B6C90A6)" Manufacturer="ManyRootsofallevil" UpgradeCode="fafffaff-c0de-c0de-c0de-123f422c0dea">Where filAB3D3C60ED5901936249D5C56B6C90A6 is the id of your library file
<Version Condition=" '$(Version)' == ''">0.0.0.1</Version>
msbuild solution.sln /p:Version=22.214.171.124