设置同时针对 x86 和 x64?
我有一个程序需要 x64 和 x86 dll(它会在运行时确定需要哪些),但是当尝试创建安装程序时,它会抱怨:
针对“AMD64”的文件 AlphaVSS.WinXP.x64.dll 与项目的目标平台“x86”不兼容
针对“AMD64”的文件 AlphaVSS.Win2003.x64.dll 与项目的目标平台“x86”不兼容
面向“AMD64”的文件 AlphaVSS.Win2008.x64.dll 与该项目的目标平台“x86”不兼容
如何使我的安装程序像我的程序那样针对两个平台?
I have a program that requires both x64 and x86 dlls (it figures out which ones it needs at run time), but when trying to create a setup, it complains:
File AlphaVSS.WinXP.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'
File AlphaVSS.Win2003.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'
File AlphaVSS.Win2008.x64.dll' targeting 'AMD64' is not compatible with th project's target platform 'x86'
How can I make my setup target both platforms like my program does?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
安装项目(在 Visual Studio 中)创建的 MSI 一次只能针对一个平台。 您的选择是制作 2 个 MSI,将它们合并在一起,然后制作一个在两者之间进行选择的自定义设置引导捆绑程序。
有一些 3rd 方产品(例如 高级安装程序)可以为您执行此操作。
The MSI created by the setup project (in Visual Studio) can only target one platform at a time. Your option is to either make 2 MSI's, merge them together and make a custom setup boot strapper that choose between the two.
There are some 3rd party products,like Advanced Installer for example, that can do this for you.
我也遇到了这个问题,写了一篇博客文章 关于我的解决方案:
deflate.exe
文件可以从 Google 代码上的存储库下载。I ran into this too and wrote a blog post about my solution:
The
deflate.exe
file can be downloaded from its repository on google code..Net 有一个“任何 CPU”选项。 人们很容易将其视为一个“通用”选项,仅使用较少的 x86 功能,但实际上它可以让每台机器上的 JIT 编译器为该机器选择适当的 cpu 类型。
唯一不应该使用它的情况是,如果您知道自己的依赖项或要求不适合一种架构或另一种架构。 例如:您知道您需要很多 RAM,您依赖于 32 位本机 dll,或者您想要预编译应用程序。
这里存在危险,因为您具有特定于平台的 dll 依赖性。 但是您有两种类型的 dll,而且听起来您知道如何在运行时选择正确的类型。 那么“任何 CPU”选项适合您吗?
.Net has an "Any CPU" option. It's tempting to think of it as more of a "generic" option that's going to only use the lesser x86 features, but really it lets the JIT compiler on each machine pick the appropriate cpu type for that machine.
The only time you shouldn't use it is if you know you have dependencies or requirements that aren't good for one architecture or the other. For example: you know you need a lot of ram, you have a dependancy on a 32-bit native dll, or you want to pre-compile the app.
There's a danger here because you have a platform-specific dll dependancy. But you have dlls for both types and it sounds like you know how to pick the right one at runtime. So will the 'Any CPU' option work for you?