我正在尝试构建一个 32/64 位的安装程序。在 32 位和 64 位机器上唯一不同的是调用 RegAsm.exe。对于 64 位机器,代码必须查看 64 位框架,而对于 32 位机器,代码必须查看标准框架。
32 位:“C:\windows\microsoft.net\framework” 64 位:“C:\windows\microsoft.net\framework64”;
我有我的包设置来运行安装操作。对于我的 64 位操作,我启用了 IsWin64 的检查。
文件名:{dotnet4064}\Regasm.exe;参数:“”“mydll.dll”“/codebase”;工作目录:{app};StatusMsg: "注册插件"; 标志:运行隐藏;检查:IsWin64;
报错前的几行日志文件
2012-12-05 14:58:53.233 Installing the file.
2012-12-05 14:58:53.281 Successfully installed the file.
2012-12-05 14:58:53.281 -- Icon entry --
2012-12-05 14:58:53.281 Filename: C:\Documents and Settings\All Users\Start Menu\Programs\myprogram\my program\Uninstall myprogram.lnk
2012-12-05 14:58:53.281 Creating directory: C:\Documents and Settings\All Users\Start Menu\Programs\myprogram\my program
2012-12-05 14:58:53.483 -- Icon entry --
2012-12-05 14:58:53.483 Filename: C:\Documents and Settings\All Users\Start Menu\Programs\myprogram\my program\myprogram.lnk
2012-12-05 14:58:54.224 -- Icon entry --
2012-12-05 14:58:54.224 Filename: C:\Documents and Settings\All Users\Desktop\myprogram.lnk
2012-12-05 14:58:54.281 Fatal exception during installation process (Exception):
Internal error: Cannot run files in 64-bit locations on this version of Windows.
2012-12-05 14:58:54.281 Exception message:
2012-12-05 14:58:54.281 Message box (OK):
Internal error: Cannot run files in 64-bit locations on this version of Windows.
2012-12-05 14:58:54.926 User chose OK.
2012-12-05 14:58:54.926 Message box (OK):
Setup was not completed.
Please correct the problem and run Setup again.
2012-12-05 14:59:00.222 User chose OK.
2012-12-05 14:59:00.222 Rolling back changes.
这一切在 64 位机器上运行良好。在 32 位机器上出现错误:
内部错误:无法在此版本的 Windows 上运行 64 位位置的文件
我一直在查看帮助文档和谷歌,无法确定发生这种情况的原因。任何帮助表示赞赏。
[Run]
Filename: "{dotnet40}\Regasm.exe"; Parameters: "My.TaskPane.dll"; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Registering MyTaskPane Add-In"
Filename: "{dotnet4064}\Regasm.exe"; Parameters: "My.TaskPane.dll"; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Registering My TaskPane Add-In"; Check: IsWin64
Filename: "{dotnet40}\Regasm.exe"; Parameters: "My.TaskPane.dll /codebase"; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Registering My TaskPane Add-In"
Filename: "{dotnet4064}\Regasm.exe"; Parameters: "My.TaskPane.dll /codebase"; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Registering My TaskPane Add-In"; Check: IsWin64
Filename: "{app}\My Software Suite.exe"; Parameters: "/register"; WorkingDir: "{app}"; Flags: PostInstall; Description: "Register the My Software Suite"
我通过添加解决了这个问题: ArchitecturesInstallIn64BitMode=x64 然后使用 Check: Is64BitInstallMode