Wix - How to run/install application without UI

浪子不回头ぞ 提交于 2019-11-26 18:02:04

MSI installs usually follow the following: https://msdn.microsoft.com/en-us/library/windows/desktop/aa372024(v=vs.85).aspx and so you can use /quiet as an option to suppress the UI and for it to just "do it"

Don't embed setup executable in MSI files

OK, the question isn't 100% clear, but I will give it a go. Delivering EXE files this way - embedded in MSI file - is not ideal. In fact it is a very bad idea - truth be told. MSI files should generally not be used just as wrappers to deliver embedded setup.exe files. The sheer complexity of MSI with its advanced impersonation, sequencing and conditioning makes this very error prone and hard to implement and test. Additionally, if the binary you embed turns out to be an MSI file wrapped in a setup.exe binary, then MSI will fail because it doesn't allow two concurrent installation sequences - unless you install them from the user interface sequence (which won't work when running silently).


Running setup.exe files silently or using Application Repackaging?

The ability of MSI files to run reliably in silent mode (without GUI) can not be matched by legacy style setups. However, often you can find switches for a legacy (or modern) setup.exe or installation binary which will allow it to be installed in silent mode, but not with MSI elevated installation rights. You would have to run with real admin rights. And additionally you often have to "record" a run though the dialogs and use the recorded responses to run the installation sequence - this is error prone since an unexpected dialog could show up where there is no recorded "response". Then you are stuck. MSI's reliable silent running is one of the key corporate advantages of MSI.

You can find a lot of information on this in this answer that I wrote a while ago: How can I use powershell to run through an installer?. Don't let the question title confuse you, the issue is still quite similar to what you are asking - at least I think so. Please give it a quick skim at least.

The answer also describes "Application Repackaging" - the process of converting legacy (or modern) setup.exe installers to native MSI format. This is a specialist task requiring good understanding of MSI but yields excellent results once done right, and silent installation is a breeze since you don't rely on frail "silent response files" as described above.


Bootstrappers / Chainers

Though I am not sure if they all allow you to install in silent mode, there are tools available that allow you to install MSI files and installation binaries in sequence from a launcher EXE file. There is another answer discussing various bootstrapper options here: Wix and .NET Framework (prerequisites). One of the bootstrappers recommended in the this discussion is dotNetInstaller. I have never used it, so I can't tell you if it is any good. It may be more GUI-based than WiX's own bootstrapper feature called Burn, however I am not sure if it is a match feature-wise. If you do test, please report your findings. There are certainly other bootstrappers out there, but it is not my area of expertise. Commercial tools such as Installshield (in their Premium version at least), have features to build such a bootstrapper using a GUI and I think they refer to them as "Install Suites" - or something like that. Just a bundle of installers and prerequisites essentially. I haven't tried this bootstrapper feature in Advanced Installer.

With regards to Burn:

  • Burn is based on XML markup and compilation - generally using Visual Studio.
  • Here is a description of How to install the .NET Framework using Burn.
  • The official documentation for Burn.
  • As you see it is a bit more involved than the tools that allow you to use a GUI to build your sequence or "chain" of installers.
  • It is free and reliable.
  • I will try to dig up a Burn sample for you.
  • OK, this should be an OK sample of what Burn can do: https://github.com/frederiksen/Classic-WiX-Burn-Theme. There are some duplicated Visual Studio project GUIDs in this sample, I think, but that shouldn't be a problem for you unless you for some reason add both projects to your build process (then the duplicated GUIDs will likely confuse your build tools - just something that happened to me once).
  • Just to be clear, Burn builds setup.exe bootstrapper bundles capable of containing both MSI files and EXE files run in a given sequence and it is part of the WiX toolkit. WiX itself builds MSI files from WiX XML source files. Burn setup.exe files are also built from WiX XML source files, but the schema is obviously different. Just for those who have never seen these tools. The sample directly above will show the difference nicely with both a WiX MSI project and a WiX Burn project. It also has a project to build a binary that is then included in both the MSI and the setup.exe.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!