3
votes

I want to build a Wix installer which will detect a few programs of mine and update them.

I have c# code (using another DLL) to check a few things on the system, then I want to download a table of the most recent version of all the apps, decide which app I need to update, and then download & update the selected ones.

So my question is, can Wix preform the following actions:

1) run another dll call using c#?

2) download a file from the web and parse it (let's say - also using c#)?

3) go to a link and download an MSI\EXE?

4) install the MSI\EXE (let's say run it on silent mode)?

5) uninstall old other apps from system?

3
I suppose you can go as far as you want. Whether that's good design or not is another question...Christopher Painter

3 Answers

1
votes

1) Yes but keep in mind that if you have a dependency on .NET 3.5 and you are on a box with .NET 4 your custom action will not be able to run. Besides this your custom action dll is unpacked from the msi into the %TEMP% folder. If you have any dependency to other dlls not stored in the GAC you will fail to load. If you bring in another e.g. C++ dll you have to embed it as resource in your C# dll and unpack it as well to find it.

2) You can do whatever you have the rights for.

3) Sure

4) Only one MSI installation can run at one time. You have to spawn some child process to wait until the current installation is over.

5) Yes sure. The easiest way is to add an Upgrade table to your msi to simply uninstall any software which has this upgrade code. This is the only allowed action where two msis at the same time can be active. Look at the InstallExecute Sequence table for RemoveExistingProducts action.

5
votes

Windows Installer has a mutex that only allows 1 execute sequence per machine and 1 UI sequence per process. One MSI cannot install another MSI due to this limitation. There are hacks around this but they don't follow good design (don't provide proper elevation support or silent install / uninstall support ).

You should use custom actions with care. A properly designed custom action should behave like the standard actions built into Windows Installer. That is support transactional installation whenever possible and be data driven via custom tables.

A better candidate for the stuff you are describing needing to be done would probably be a bootstrapper / chainer such as WiX's Burn feature.

2
votes

1) - definitely yes

2)-5) you could do it but you should differ msi from "custom bootstrapper" and "custom after install configuration manager". General rule: use msi package only for resource (usually files; in more complex cases - registry, in most cases sql objects) atomic deployment; move all other functionality outside msi (means use wix ony to build msi; create custom utilities for bootstrapper and configuration tool; see wix samples how to integrate three parts together).