通过 ClickOnce 部署识别目标计算机(32 位或 64 位)

发布于 2024-10-05 13:17:09 字数 218 浏览 1 评论 0原文

我有一个 Windows 窗体 应用程序,并通过 ClickOnce 部署来部署该应用程序。现在,我有一个第三方 DLL 文件,它有针对 32 位和 64 位操作系统的不同版本。

是否可以通过ClickOnce根据目标机器(32位或64位)部署不同的DLL文件?

I have a Windows Forms application and am deploying that application through ClickOnce deployment. Now, I've a third-party DLL file and it has different versions for 32-bit and 64-bit OS.

Is it possible to deploy different DLL files based on the target machine (32-bit or 64-bit) through ClickOnce?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

夜未央樱花落 2024-10-12 13:17:09

[编辑]

没有必要使用反射。您可以直接在加载程序中添加对程序的引用并启动它。在 Tech and Me< 上发表了一篇包含相关代码的博客文章< /a>.


You could include both versions in your deployment, but name them differently. Then have a loader app check if you are on a 32bit or 64bit system, copy the correct dll (eg thirdparty64.dll -> thirdparty.dll) which your real program is linked to, and then invoke your program from the loader with for example Assembly.Load and use reflection to start your main method.

一种更简单的方法是将应用程序编译为 x86 运行,确保它始终在 32 位模式下运行。如果您不依赖于 32/64 位版本的计算机上安装的某些特定应用程序,这可能是最佳选择。

[Edit]

It's not necessary to use reflection. You can add a reference to your program directly in the loader and kick it off. Did a blog post with code about it at Tech and Me.


You could include both versions in your deployment, but name them differently. Then have a loader app check if you are on a 32bit or 64bit system, copy the correct dll (eg thirdparty64.dll -> thirdparty.dll) which your real program is linked to, and then invoke your program from the loader with for example Assembly.Load and use reflection to start your main method.

An easier method is to compile your application to run as x86, ensuring it will always run in 32bit mode. If you don´t rely on some specific application being installed on the machine in 32/64bit versions this could be the best choice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文