简体   繁体   English

使用32位MSI在64位Windows上安装“AnyCPU”程序有什么危害?

[英]What's the harm to install a “AnyCPU” program on a 64-bit Windows using a 32-bit MSI?

My application is built using the " Any CPU " configuration. 我的应用程序是使用“ Any CPU ”配置构建的。 The WIX installer for the application is built with platform=x86 so the resultant MSI is 32-bit. 应用程序的WIX安装程序使用platform=x86构建,因此生成的MSI为32位。

When I run the 32-bit MSI on a 64-bit Windows. 当我在64位Windows上运行32位MSI时。 The [ProgramFilesFolder] property is resolved to "C:\\Program Files (x86)" and the registry paths are resolved to the Wow6432Node . [ProgramFilesFolder]属性被解析为“C:\\ Program Files(x86)”,注册表路径被解析为Wow6432Node When I run the application, the process is 64bit - as expected. 当我运行应用程序时,该过程是64位 - 正如预期的那样。

As far as I understand after reading lots of related posts on SO. 据我所知,在阅读了很多关于SO的相关帖子后。 On a 64-bit Windows, to make the [ProgramFilesFolder] resolved to "C:\\Program Files" and registry path to normal path (not under Wow6432Node ). 在64位Windows上,使[ProgramFilesFolder]解析为“C:\\ Program Files”并将注册表路径转换为正常路径(不在Wow6432Node下)。 I need a separate 64-bit MSI. 我需要一个单独的64位MSI。 Which I am trying to avoid - For me, to have a separate 64-bit MSI merely for [ProgramFilesFolder] and regsitry path to resolve to correct location is not worthwhile. 我试图避免 - 对我来说,仅为[ProgramFilesFolder]而单独的64位MSI以及解决纠正位置的regsitry路径是不值得的。 As long as my program still runs 64-bit on a 64-bit Windows, I don't really care about it is installed at "C:\\Program Files (x86)" by default and some registry values exist at Wow6432Node . 只要我的程序在64位Windows上仍然运行64位,我并不关心它默认安装在“C:\\ Program Files(x86)”并且Wow6432Node存在一些注册表值。

So, my question is, is there the other consequences when I install a "AnyCPU" program on a 64-bit Windows using a 32-bit MSI other than by default the installDir is "C:\\Program Files (x86)" and some registry values are stored under the Wow6432Node ? 所以,我的问题是,当我使用32位MSI在64位Windows上安装“AnyCPU”程序时,除了默认情况下,installDir是“C:\\ Program Files(x86)”和其他一些后果注册表值存储在Wow6432Node

The only real harm that could arise is if your program tries to read the values that are stored in the 32 bit registry view. 可能出现的唯一真正的危害是,如果您的程序试图读取存储在32位注册表视图中的值。 Of course it will fail to find them when running as a 64 bit process. 当然,当作为64位进程运行时,它将无法找到它们。 If that happens then you could simply use the RegistryView enumeration to force reading from the 32 bit view. 如果发生这种情况,那么您可以简单地使用RegistryView枚举来强制从32位视图读取。 But I guess that the registry settings you mention are related to the installer. 但我想你提到的注册表设置与安装程序有关。

In fact the scenario you describe is how I deploy my app. 实际上,您描述的场景是我部署应用程序的方式。 Because I deploy both 32 and 64 bit versions to the same machine, and because they share some files, I install everything to 32 bit program files. 因为我将32位和64位版本部署到同一台机器,并且因为它们共享一些文件,所以我将所有内容安装到32位程序文件中。 And then all registry access is to the 32 bit view. 然后所有注册表访问都是32位视图。 There's really no alternative if you want both 32 and 64 bit versions to share the same values in the redirected portions of the registry. 如果您希望32位和64位版本在注册表的重定向部分中共享相同的值,那么实际上没有其他选择。

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

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