Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preprocessor variable with WiX version #4821

Open
wixbot opened this issue Jul 9, 2015 · 6 comments
Open

Add preprocessor variable with WiX version #4821

wixbot opened this issue Jul 9, 2015 · 6 comments

Comments

@wixbot
Copy link

wixbot commented Jul 9, 2015

I have some WiX projects that I'd like to be able to use on multiple machines which each may have a different version of WiX 3.x installed.

It would be nice to be able to conditionally include/exclude code depending on which version of the WiX toolset is currently executing.

Here's a suggested implementation:

Variable Value
$(sys.WIX_VERSION) 3.10.1823.0
$(sys.WIX_MAJORVERSION) 3
$(sys.WIX_MINORVERSION) 10
$(sys.WIX_BUILDVERSION) 1823
$(sys.WIX_UPDATEVERSION) 0

Originally opened by david

@wixbot
Copy link
Author

wixbot commented Jul 9, 2015

ps. I'd be happy to create a PR for this if the idea is approved.

Originally posted by david

@wixbot
Copy link
Author

wixbot commented Jul 14, 2015

You can do this at a file level already using Wix/@RequiredVersion. We don't understand the use case, though; can you provide a concrete example?

@wixbot
Copy link
Author

wixbot commented Jul 14, 2015

The particular scenario I'm looking at relates to the now deprecated Action="createAndRemoveOnUninstall" attribute. This generates a warning in more recent versions of Wix, but didn't in earlier ones. And if you build with 'warnings as errors' then that fails the build.

I'd like to be able to conditionally include the original line for older versions of Wix, but switch to a newer line for more recent ones. (In my situation most machines are running the old version of Wix, and it will take some organising to upgrade them all, but for testing out VS2015, my own machine is running 3.10)

Originally posted by david

@wixbot
Copy link
Author

wixbot commented Jul 16, 2015

FYI - I had a similar problem when I moved from 3.8 to 3.9 (if I recall because there was a change to util:ProductSearch). My 3.8 code as I recall failed to compile in 3.9. I was using 3.9 in my dev system but the build box needed to stay at 3.8 for a period of time. To address this I used MSBuild to detect the version of WiX and set a MSBuild property which I used with:
<CompilerAdditionalOptions>
$(CompilerAdditionalOptions)
-dmyWixVer="$(myWixVer)"
</CompilerAdditionalOptions>

And then in the wxs I used preprocessor for $(var.myWixVa) to build code compatible with 3.8 on the build box and compatible with 3.9 on my system.  When I updated the build box to 3.9 I tossed all of this code.

Originally posted by phogland

@wixbot
Copy link
Author

wixbot commented Jul 17, 2015

I can see it being useful if you have BA extensions or customisations as it would allow the correct one to be loaded based on which version of WiX is installed. For example, I would like to trial 3.10 and an updated ExtBA but my build machine is still 3.9.

Originally posted by neilsl

@wixbot
Copy link
Author

wixbot commented Jul 21, 2015

OK, sounds reasonable. We've added new warnings but everything else is compatible.

@wixbot wixbot added this to the v3.x milestone Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant