Windows installer and setup application into one f

2019-05-15 10:00发布

I have written a application in C# using visual studio, I have made a project set up file which as created to files for me in my debug.

The Windows Installer and the setup application are both needed, but i would like to merge them into one, like when you download an app the installer its just one file.

Could some one please show me how to do this, or just point me towards a good source.

enter image description here

Thanks in advance.

1条回答
▲ chillily
2楼-- · 2019-05-15 10:23

If you're using Visual Studio's built-in setup project template to generate your installer, then you don't need the setup.exe file at all.

The only thing you need to distribute is the .msi file. That contains everything that a user would need to install your application. The setup.exe file is simply a stub that launches the setup routines from information in the .msi file, which is a database that the Windows Installer uses to install your application. And since these files can be launched by double-clicking on them if the Windows Installer service is installed, you really don't need to distribute the setup.exe bootstrapper if you don't want to.

Some special reasons that you might want to distribute a setup.exe file are:

  • You expect for some reason that your users might not have the required version of the Windows Installer installed on their computer. This is getting to be pretty rare nowadays, especially considering how widespread broadband Internet connections are and how pushy OS vendors are getting with pushing automatic updates. But if your users are "disconnected" (in many senses of the word), you might want to use a setup executable to verify the presence of the necessary version of the Windows Installer, install it if it isn't there, and then launch your .msi file to perform the install. (You cannot run a .msi file if you do not have Windows Installer installed.)

  • You need to support multiple languages. In this case, the setup.exe file can perform a language transformation on the .msi file before launching the installer.

  • You want to manage the installation of several .msi files in sequence. The way that Windows Installer is designed, it's difficult to chain installations of .msi files, which makes it difficult to install dependencies before or after you install your own application's files. A setup.exe file is not subject to the limitations of the Windows Installer, so it can be used to chain these and precisely manage the order of installation.

  • In general, creating your own setup.exe file (or using one of the many third-party installer software packages to create it for you) gives you significantly greater flexibility. You essentially have complete control over the installation process, rather than having to follow the rules of Windows Installer.

But 83.44% of the time, this isn't necessary and you should follow the much simpler route of using an .msi file. This also allows system administrators to automate installs across machines that they manage (for example, throughout a corporate network), something that is not supported for raw executable files.

查看更多
登录 后发表回答