问题
I simply need to install multiple instances of my application saving them in different folders, with no shortcut on desktop. In other words, when the App is already installed in a Folder, if I double-click the .msi file once again, the installer shouldn’t ask me if I want repair or remove my App, but it simply should permit to install it in a new folder. How can I solve this problem?
回答1:
I used to work with this kind of installations before, and I would agree with @Nikolay - it is rather an exception, than the rule when it comes to Windows Installer based installations. Component rules are often tricky to follow, and multiple instances aspect adds some complexity on top. So, think twice before you go this road.
Being complex, it is still possible. Years ago I published the article of how to start authoring multiple instance installations with WiX 3.6. Note that this version of WiX simplifies it significantly. It's not a short read, so here is a quick digest:
- You won't be able to achieve the "install each new instance with double-clicking MSI file" behavior. You have to have a bootstrapper - something that passes correct command line parameters to
msiexec.exe
. - Don't try to support unlimited number of instances - try sticking with reasonably big number. Do you imagine someone installing your app 10 times on a machine? 50? 100? Make a sane choice - this will be the number of your
<Instance/>
elements. - Although you only have to decorate non-file data components with
MultiInstance
attribute, I don't think it will break if you add it to all of your components. - Although I explained the patching of multiple instances in that post, I would only use it in production if I had no other choice.
回答2:
What you are asking for is not normal in Windows. Normally, each program (product) is installed only once. I.e. each installation package has it's ID (called "ProductID"). If that ID already registered in the system as installed, the system will not allow you to install the second product with the same ProductID, but start change/remove.
What you can do:
- Don't use Windows Installer (and WIX), use ZIP for example, or some self-extracting archive, or some other program which does not register installed product in the system.
- Use command line to change product id before installing if you want MSI and Windows Installer for whatever reason. Try googling on "use transforms to install the same MSI multiple times". Thus you can have the same MSI per-transformed before installation, so that it looks as a different one to the system.
- Install per-user, if that's good enough for you (i.e. don't install to Program Files, install to user folder)
- Maybe there are other options...
来源:https://stackoverflow.com/questions/33540670/installing-multiple-instances-of-an-application-with-wix-toolset