A few questions...

Apr 13, 2015 at 3:10 PM
Edited Apr 13, 2015 at 3:11 PM
First of all, great work! Wix# fulfills a dire need to be able to create MSI's relatively easily without the cost of an expensive license...
Here are my questions:

1) is it possible to pass the MSIEXEC command line parameters to the InstallFileAction parameters? I'm asking because I'm launching a custom executable which needs to know if it's an install or an uninstall, quiet mode or not, etc...
Related to that, I need to "plug" the /uninstall parameter when the app is uninstalled from Control Panel (i.e. when there is no explicit /uninstall parameter from a command line).

2) how do you implement an install/upgrade that will always work regardless of what may already be installed?

I tried this below, but that does not seem to work:
        wix.Project.MajorUpgradeStrategy = new MajorUpgradeStrategy
        {
            UpgradeVersions = VersionRange.ThisAndOlder,
            PreventDowngradingVersions = VersionRange.ThisAndNewer,
            NewerProductInstalledErrorMessage = "Newer version already installed"
        };
...namely the install will fail if the MSI is simply recompiled, and reapplied.

Thanks,

Jean-Marc
Coordinator
Apr 14, 2015 at 6:30 AM
Edited Apr 14, 2015 at 6:31 AM
Thanks.

1

Technically speaking it is an MSI question and I am not completely confident in my understanding the all details/differences of invoking msiexec from a command line and ControlPanel. My immediate answer is that the these two different uninstall use-cases cannot be distinguished at runtime because they cause the same set of MSI properties: Installed, UILevel... But I may be wrong. If you manage to find the answer please share it with me.

I had to solve similar problem when I needed to detect repair from ControlPanel/CommandPrompt and from external UI. But it was much easier as I could set some MSI properties from the custom UI app itself.

2

...namely the install will fail if the MSI is simply recompiled, and reapplied.
I don't think what you are trying to achieve is consistent with MSI installation/upgrade paradigm. If you just recompile the msi you will end up with the identical MSI and the only thing you can try to achieve if you execute msi second time (after rebuild) is the start of "repair sequence". I don't think it is what you need.

However if you indeed OK with the repair then you have an unexpected surprise here. If you rebuild msi from an identical source code MSI runtime will recognize it as a different msi file. I just did the experiment and built msi from a canonical "Wix# Samples\Install Files" sample. Though I used BuildMsiCmd to build and rebuild the actual msi. So no Wix# is involved in msi authoring at all. All done with WiX compilers only. And... the generated binaries are different. I guess WiX injects something even if it is the same WiX XML source. So if you install one and then execute another one you will get error "this version is not installed...."