为什么 Visual Studio 创建 .exe 安装程序文件?
当我在 Visual Studio 中构建解决方案时,会生成安装程序文件作为 .exe 和 .msi,.exe 文件有什么用?
when I build solutions in Visual Studio, that generates installer files as .exe and .msi, .exe files are useful for what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
安装程序项目创建的
.EXE
文件是.MSI
安装文件的引导程序。它用于启动.MSI
安装文件。通常,两者都会启动安装程序并允许用户安装应用程序。但是,有时
setup.exe
文件会运行自定义验证例程来确定用户的计算机是否满足安装软件的最低要求。例如,如果用户没有 Windows Installer,他们将无法启动
.MSI
文件,但.EXE
应用程序仍会运行并通知他们:他们需要先安装 Windows Installer。特别是对于 .NET 应用程序,.EXE
文件会验证是否存在适当版本的 .NET Framework,如果不存在,则会提示用户下载并安装它。您可以使用 Visual Studio 在安装程序项目中自定义应用程序所需的先决条件。有关如何执行此操作的详细信息,请参阅以下 MSDN 文章:
The
.EXE
file that is created by the installer project is a bootstrapper for the.MSI
setup file. It is used to launch the.MSI
setup file.Generally, both will launch the setup program and allow the user to install the application. However, sometimes the
setup.exe
file will run a custom validation routine to determine if the user's computer meets the minimum requirements for installing the software.For example, if the user does not have Windows Installer, they will not be able to launch the
.MSI
file, but the.EXE
application will still run and inform them that they need to install Windows Installer first. For .NET applications specifically, the.EXE
file verifies the presence of the appropriate version of the .NET Framework, and if it is not present, it prompts the user to download and install it.You can customize the prerequisites that are required for your application in your installer project using Visual Studio. See these MSDN articles for details on how to do that:
其他人对如何(.exe 引导 .msi)发表了评论,但部分原因原因是用户知道 .exe 文件是您运行的东西。我认为普通用户不知道 .msi 文件是可以单击来安装应用程序的文件。
Others have commented on the how (.exe bootstraps the .msi) but part of the reason why is that users know that .exe files are the things you run. I don't think your average user knows that .msi files are something that you can click on to install an application.
.exe
文件用于安装应用程序的先决条件。假设您的应用程序使用 .Net 3.5 框架,您可以告诉安装程序项目包含所需库的安装(如果尚未安装)。
您也可以停用它,以便仅创建
.msi
。此页面显示了如何激活和配置先决条件设置,只需取消选中中的复选框即可命令将其停用。
您还可以在 MSDN 上找到有关引导过程的更多详细信息< /a>:
The
.exe
file is made for installing the prerequisites of your application.Let's say your application uses the .Net 3.5 framework, you can tell the installer project to include the installation of the needed libraries if they're not already installed.
You may also deactivate it, so only the
.msi
is being created.This page shows how to activate and configure the prerequisites setup, just uncheck the checkbox in order to deactivate it.
You also find more details on the process of Bootstrapping on MSDN:
假设您不执行 Web 应用程序,
.exe
文件对于执行您刚刚在 Visual Studio 中构建的程序非常有用。几乎每个 Windows 程序都是使用带有
.exe
后缀的文件执行的。.exe
files are useful for executing your programs that you've just built in Visual Studio, assuming you're not doing web applications.Pretty much every Windows program out there is executed using files with an
.exe
suffix.安装程序 exe 文件通常只是封装在引导程序中的 msi。引导程序可以执行任何操作,但通常其目的是确保用户运行足够版本的 Windows Installer,然后提取 msi 并调用
msiexec.exe
开始安装 msi。如今,将安装程序生成为 exe 已被弃用,但有些人仍然这样做。Installer exe files are normally just the msi wrapped in a bootstrapper. The bootstrapper can do anything, but normally its purpose is to ensure the user is running a sufficient version of Windows Installer, then extract the msi and invoke
msiexec.exe
to start installing the msi. Generating installers as exe's is deprecated these days, but some still do it.