设置同时针对 x86 和 x64?

发布于 2024-07-18 05:06:37 字数 316 浏览 4 评论 0原文

我有一个程序需要 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

╭⌒浅淡时光〆 2024-07-25 05:06:37

安装项目(在 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.

数理化全能战士 2024-07-25 05:06:37

我也遇到了这个问题,写了一篇博客文章 关于我的解决方案:

  • 使用 deflate.exe 对文件进行压缩,使用不同的扩展名(例如 .x64)
  • 将其作为内容文件添加到您的主项目中
  • 将自定义操作项目添加到您的解决方案
  • 中 将自定义操作添加到设置中项目“安装”自定义操作
  • 在自定义操作中膨胀文件使用
  • System.IO.Compression.DeflateStream 安装方法(请参阅上面的代码)
  • 在您的办公桌周围、沿着大厅、以及您想惹恼的尽可能多的同事中跳一小段舞:)

deflate.exe 文件可以从 Google 代码上的存储库下载。

I ran into this too and wrote a blog post about my solution:

  • deflate the file using deflate.exe, naming it with a different extension (e.g. .x64)
  • add it to your main project as a content file
  • add a custom action project to your solution
  • add the custom action to the setup projects "Install" custom actions
  • inflate the file inside the custom actions Install method using
  • System.IO.Compression.DeflateStream (see code above)
  • do a little dance around your desk, down the hall, and past as many coworkers as you care to annoy :)

The deflate.exe file can be downloaded from its repository on google code.

山有枢 2024-07-25 05:06:37

.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?

_失温 2024-07-25 05:06:37
  1. 打开部署项目。
  2. 在解决方案资源管理器中,选择部署项目。
  3. 在“属性”窗口中,选择 TargetPlatform 属性。
  4. 为 Intel Itanium 64 位平台选择 Itanium,或为任何其他 64 位平台(例如 AMD64 和 EM64T 指令集)选择 x64。
  5. 安装时,如果目标计算机与指定平台不兼容,则会出现错误并停止安装。
  1. Open a deployment project.
  2. In the Solution Explorer, select the deployment project.
  3. In the Properties window, select the TargetPlatform property.
  4. Choose either Itanium for an Intel Itanium 64-bit platform, or x64 for any other 64-bit platform (such as AMD64 and EM64T instruction sets).
  5. At installation time, an error will be raised and installation will be halted if the target computer is not compatible with the specified platform.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文