Reputation: 21
In my WIX project i do have BuildVersion variable read from .exe file of my application. Lets say currently its 1.0.0.0. General idea is to allow users to install multiple version of application on single pc. There are 2 problems:
How to create .msi output files with version information in its name ? For example Application_v1.0.msi. To be honest i have no idea where to even start with that.
How to create separate folders for each version in Start menu, and Program files ? Idea is to have structure like Application/v1-0 (v2-0, v3-1 ..generaly v[major]-[minor]) in both - start menu and Program files.
According to point 2 so far i tried something "simple", like this in localisation file:
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="ProductNameFolder">MyApp\[BuildVersion]</String>
And then in file where i do have "directory" section:
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Shortcut folder is a Start Menu Folder-->
<Directory Id="ProgramMenuFolder">
<Directory Id="InstallProgramMenuFolder" Name="!(loc.ProductNameFolder)" />
</Directory>
<?if $(var.Platform)=x86 ?>
<!-- Program Files folder-->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="!(loc.ProductNameFolder)" />
</Directory>
<?else?>
<!-- Program Files (64 bit) folder-->
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="!(loc.ProductNameFolder)" />
</Directory>
<?endif?>
</Directory>
But when im trying to build im getting errors Invalid DefaultDir string
everywhere where im using loc.ProductNameFolder.
I have tried also something like that in Directory section:
<Directory Id="InstallProgramMenuFolder" Name="!(loc.ProductNameFolder)\$(var.BuildVersion)" />
But that does give me errors like:
The Directory/@Name attribute's value '!(loc.PoductNameFolder)\1.0.0.0', is not a valid long name because it contains illegal characters
General idea is to have folder name like v[major]-[minor] but at start im trying simple version=folder name concept. No idea how i could convert Version to v[major]-[minor] so far as well.
Im using WIX Toolset 3.11.2, and Visual Studio 2019 Extension.
Upvotes: 0
Views: 897
Reputation: 21
My own "partial" solution for point 1 - instalation file name with version:
Unload project, add something like this in BeforeBuild section :
get buildversion:
<GetAssemblyIdentity AssemblyFiles="..\src\MyApp\bin\Debug\MyApp.exe">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
Create custom .msi name with version:
<CreateProperty Value="MyAppInstaller_v%(AssemblyVersion.Version)">
<Output TaskParameter="Value" PropertyName="TargetName" />
</CreateProperty>
In result you will get something like MyAppInstaller_v1.0.0.0. Still i would need to convert it to MyAppInstaller_v1.0
Upvotes: 0