Reputation: 5626
In my installer project (WiX), I define a preprocessor variable like on the Build tab of the properties pages like so:
Version=1.1.0.0
For the sake of argument, let's say I can just as easily define it as a variable instead of a preprocessor variable.
My goal is thus: I would like to use this variable in the installer output name:
Me.Common_$(Version)
The above, of course, doesn't work - the variable referenced isn't found, so the actual output ends up being Me.Common_.msi
. Is there a way to use a user-defined variable in this context?
Another viable option would be to rename the MSI file in the post-build events. However, I still can't access the variable here.
ren "!(TargetPath)" "$(TargetName)_$(Version)$(TargetExt)"
A solution to either of these methods would work for me.
Upvotes: 3
Views: 1726
Reputation: 394
Find/add these in your .wixproj file, under first PropertyGroup node:
<Version Condition=" '$(Version)' == ''">1.1.0.0</Version>
<OutputName>My.Common_$(Version)</OutputName>
then, when you compile you can pass Version with "/p" switch, i.e.:
msbuild <your.wifproj> /p:Version=1.1.2.0 /t:rebuild
Upvotes: 3
Reputation: 7973
I'm not sure how you would do that, by just using WIX.
I would try to use MSBuild and Target Builds
Have a look at my post on SO, for passing params to MSBuild
Upvotes: 0