从x86 msi将文件安装到x64“Program Files”

时间:2021-12-09 15:13:58

I'm creating installer using InstallShield 2010 (basic MSI) that is having two features.

我正在使用具有两个功能的InstallShield 2010(基本MSI)创建安装程序。

First feature consists of:

第一个功能包括:

  • main .NET application compiled as x86,
  • 主要的.NET应用程序编译为x86,
  • some native x86 third party dlls which are used by main application (x64 versions are unavailable).
  • 主应用程序使用的一些本机x86第三方dll(x64版本不可用)。

Second feature contains single component which is an extension for MS Reporting Services compiled as AnyCPU.

第二个功能包含单个组件,它是编译为AnyCPU的MS Reporting Services的扩展。

During UI sequence I'm using InstallScript custom action to enumerate all available Reporting Services instances from both x86 and x64 registry trees.

在UI序列期间,我使用InstallScript自定义操作来枚举x86和x64注册表树中的所有可用Reporting Services实例。

The user is prompted to select on which instance he wants to deploy our extension.

系统将提示用户选择要部署扩展的实例。

Based on selected instance I'm quering registry for actual location of Reporting Services in file system which is usually something like "C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services" and storing this value in a MSI Property.

基于所选实例,我在文件系统中查询Reporting Services的实际位置,通常类似于“C:\ Program Files \ Microsoft SQL Server \ MSSQL.2 \ Reporting Services”,并将此值存储在MSI属性中。

Then by using Set Directory action I'm setting destination directory of a component (our extension) to the value of that MSI Property.

然后通过使用Set Directory操作,我将组件的目标目录(我们的扩展名)设置为该MSI属性的值。

Everything is installing perfectly fine unless you've trying to install it for x64 Reporting Services in that case extension files are installed to wrong location. Even thou MSI Property is set to correct path "C:\Program Files\MicroSoft..." (I've checked msi log) it looks like system is automatically redirecting to "Program Files (x86)".

除非您尝试为x64 Reporting Services安装它,否则一切都安装得非常好,因为扩展文件安装在错误的位置。即使您将MSI属性设置为正确的路径“C:\ Program Files \ MicroSoft ...”(我已经检查了msi日志)它看起来系统自动重定向到“Program Files(x86)”。

Is there any possible solution to overcome this issue?

有没有可能的解决方案来克服这个问题?

3 个解决方案

#1


3  

If you need to install to the 64-bit ProgramFiles folder, use a 64-bit MSI.

如果需要安装到64位ProgramFiles文件夹,请使用64位MSI。

#2


0  

Finally solved this issue myself without creating 64bit MSI by using InstallScript custom actions.

最后我自己解决了这个问题,而没有使用InstallScript自定义操作创建64位MSI。

First custom action to install:

首先安装自定义操作:

  • Manually copy required files to desired location (InstallScript can access x64 Program Files)
  • 手动将所需文件复制到所需位置(InstallScript可以访问x64程序文件)
  • Save this location in registry as a key component for this feature to use during uninstall
  • 将此位置保存在注册表中,作为此功能在卸载期间使用的关键组件

Second custom action to uninstall:

卸载的第二个自定义操作:

  • Read installed location from registry (do not use System Search to get this value due to it'll be auto translated by WindowsInstaller to "ProgramFiles (x86)")
  • 从注册表中读取安装位置(不要使用系统搜索获取此值,因为它将由WindowsInstaller自动转换为“ProgramFiles(x86)”)
  • Delete files
  • 删除文件

#3


0  

You can change the INSTALLDIR property to ProgramFile64 rather then ProgramFiles, this will help you to install on desired path, since you application is 32-bit so the path will be C:\ProgramFiles(x86)\Your Company Name\Your Product Name along with this have you made your components as 64-bit compatible?

您可以将INSTALLDIR属性更改为ProgramFile64而不是ProgramFiles,这将帮助您在所需的路径上安装,因为您的应用程序是32位,因此路径将是C:\ ProgramFiles(x86)\ Your Company Name \ Your Product Name along有这个你是否使你的组件兼容64位?

#1


3  

If you need to install to the 64-bit ProgramFiles folder, use a 64-bit MSI.

如果需要安装到64位ProgramFiles文件夹,请使用64位MSI。

#2


0  

Finally solved this issue myself without creating 64bit MSI by using InstallScript custom actions.

最后我自己解决了这个问题,而没有使用InstallScript自定义操作创建64位MSI。

First custom action to install:

首先安装自定义操作:

  • Manually copy required files to desired location (InstallScript can access x64 Program Files)
  • 手动将所需文件复制到所需位置(InstallScript可以访问x64程序文件)
  • Save this location in registry as a key component for this feature to use during uninstall
  • 将此位置保存在注册表中,作为此功能在卸载期间使用的关键组件

Second custom action to uninstall:

卸载的第二个自定义操作:

  • Read installed location from registry (do not use System Search to get this value due to it'll be auto translated by WindowsInstaller to "ProgramFiles (x86)")
  • 从注册表中读取安装位置(不要使用系统搜索获取此值,因为它将由WindowsInstaller自动转换为“ProgramFiles(x86)”)
  • Delete files
  • 删除文件

#3


0  

You can change the INSTALLDIR property to ProgramFile64 rather then ProgramFiles, this will help you to install on desired path, since you application is 32-bit so the path will be C:\ProgramFiles(x86)\Your Company Name\Your Product Name along with this have you made your components as 64-bit compatible?

您可以将INSTALLDIR属性更改为ProgramFile64而不是ProgramFiles,这将帮助您在所需的路径上安装,因为您的应用程序是32位,因此路径将是C:\ ProgramFiles(x86)\ Your Company Name \ Your Product Name along有这个你是否使你的组件兼容64位?