C# 合并 msi 和 exe

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/535966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 07:10:28  来源:igfitidea点击:

Merge msi and exe

c#deployment

提问by Presidenten

My deployment project creates and .msi-file and an .exe-file. Is it possible to merge these into one .exe?

我的部署项目创建了 .msi 文件和一个 .exe 文件。是否可以将它们合并为一个 .exe?

回答by Dirk Vollmar

Yes, you can create a self-extracting installer containing both MSI and the setup.exe bootstrapper file.

是的,您可以创建一个包含 MSI 和 setup.exe 引导程序文件的自解压安装程序。

I think it is possible to do that with WinZip, or you can use IExpress coming with Windows. Here is a guide how to create a self-extracting executable with IExpress. You can either use the IExpress wizard or manually write a config file which you then can execute in the post-built step of your setup project, e.g. by calling

我认为使用 WinZip 可以做到这一点,或者您可以使用 Windows 附带的 IExpress。这是如何使用 IExpress创建自解压可执行文件的指南。您可以使用 IExpress 向导或手动编写一个配置文件,然后您可以在安装项目的后期构建步骤中执行该文件,例如通过调用

IExpress /N /Q MySetup.sed

A sample configuration file would look like this:

示例配置文件如下所示:

[Version]
Class=IEXPRESS
SEDVersion=3
[Options]
PackagePurpose=InstallApp
ShowInstallProgramWindow=1
HideExtractAnimation=1
UseLongFileName=1
InsideCompressed=0
CAB_FixedSize=0
CAB_ResvCodeSigning=0
RebootMode=N
InstallPrompt=%InstallPrompt%
DisplayLicense=%DisplayLicense%
FinishMessage=%FinishMessage%
TargetName=%TargetName%
FriendlyName=%FriendlyName%
AppLaunched=%AppLaunched%
PostInstallCmd=%PostInstallCmd%
AdminQuietInstCmd=%AdminQuietInstCmd%
UserQuietInstCmd=%UserQuietInstCmd%
SourceFiles=SourceFiles
[Strings]
InstallPrompt=
DisplayLicense=
FinishMessage=
TargetName=MySetup.exe
FriendlyName=My cool application
AppLaunched=CMD /C setup.exe
PostInstallCmd=
AdminQuietInstCmd=
UserQuietInstCmd=
FILE0="setup.exe"
FILE1="MySetup.msi"
[SourceFiles]
SourceFiles0=
[SourceFiles0]
%FILE0%=
%FILE1%=

There is a little caveat however with the self-extracting installer scenarios. Due to another fix these scenarios are brokenwith the bootstrapper (setup.exe) created by VS2008 SP1. For a workaround see the following thread: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/3731985c-d9cc-4403-ab7d-992a0971f686/?ffpr=0.

然而,对于自解压安装程序场景,有一点需要注意。由于另一个修复,这些场景被VS2008 SP1 创建的引导程序 (setup.exe)破坏了。有关解决方法,请参阅以下线程:http: //social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/3731985c-d9cc-4403-ab7d-992a0971f686/?ffpr=0

回答by Junior Mayhé

I like it, you can see how to use IExpress on this link!

我喜欢它,您可以在此链接上了解如何使用 IExpress !

The only problem I see was that I've generated a installer on Windows Vista 64bits, I was trying to install the generated .exe in a server with Windows Server 2008 32bits, but it throws an error about processor type.

我看到的唯一问题是我在 Windows Vista 64 位上生成了一个安装程序,我试图在装有 Windows Server 2008 32 位的服务器中安装生成的 .exe,但它引发了关于处理器类型的错误。

回答by torpederos

Another option could be 7zip with sfx plugin: http://www.7-zip.org/download.htmlor WinZip self extractor: http://www.winzip.com/prodpagese.htm

另一种选择可能是带有 sfx 插件的 7zip:http://www.7-zip.org/download.html或 WinZip 自解压器:http: //www.winzip.com/prodpagese.htm