简体   繁体   English

为32位和64位应用程序启动正确的安装程序

[英]launching correct installer for 32 and 64-bit apps

We have an application which, for various reasons, needs to be compiled as both a 32-bit and 64-bit app. 我们有一个应用程序,由于各种原因,需要编译为32位和64位应用程序。 The thing is, we want to distribute both setup files (msi) on a single CD. 问题是,我们希望在一张CD上分发两个设置文件(msi)。 Is there a launch condition or autorun.inf entry that we can use to know which setup.exe to launch? 是否有启动条件或autorun.inf条目,我们可以用它来知道要启动哪个setup.exe? Or do we need to write a separate little exe that gets called by autorun, and which determines the OS, and calls the appropriate setup.exe? 或者我们是否需要编写一个由autorun调用的单独的小exe,它确定操作系统,并调用相应的setup.exe?

There does not appear to be any 32/64bit detection support inherent in autorun.inf files . autorun.inf文件中似乎没有固有的任何32/64位检测支持。

The convention that most applications which supply a 32 and 64 bit MSI follow is similar to the second option you mention. 大多数提供32位和64位MSI的应用程序遵循的惯例类似于您提到的第二个选项。

  1. Create a single 32bit setup.exe application (so that it will run on either platform). 创建一个32位的setup.exe应用程序(以便它可以在任一平台上运行)。 Ideally this will be written in C/C++ so that it is as small and quick as possible, and has no dependencies on other libraries/frameworks (eg. static linked). 理想情况下,这将使用C / C ++编写,以便尽可能小和快,并且不依赖于其他库/框架(例如静态链接)。
  2. Detect if you are running on 64bit or not (see sample code for Windows API IsWow64Process function 检测您是否在64位上运行(请参阅Windows API IsWow64Process函数的示例代码
  3. Execute the appropriate MSI 执行适当的MSI

You can use a custom action to detect the OS, then call the right installer. 您可以使用自定义操作来检测操作系统,然后调用正确的安装程序。

I've given an example here: Single MSI to install correct 32 or 64 bit c# application 我在这里举了一个例子: 单个MSI安装正确的32或64位c#应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM