隔离强制 32 位程序集

发布于 2024-08-23 13:38:40 字数 302 浏览 3 评论 0原文

给定一个用 .NET 编写的相对较大的本土框架。对于额外的较低优先级功能,我们希望使用第三方开源项目。然而,这个第三方项目在 x64 模式下运行并不安全,因此我们强制它编译 32 位。由于这个引用的 32 位程序集,VS 希望我们的整个框架通过级联依赖项编译为 32 位。

问题1:有没有办法隔离框架的其余部分并允许其编译到任何平台? 问题2:假设我的框架在 x64 模式下运行,并且在运行时我加载了强制的 32 位程序集。这会起作用还是会抛出 AssemlyLoadWhateverException?

Given a relatively big home-grown framework written in .NET. For an additional lower priority feature, we would like to use a third party open source project. However, this third party project is not safe to run in x64 mode, so we force it to compile 32bit. Due to this referenced 32bit assembly, VS wants our entire framework being compiled to 32bit via cascading dependencies.

Question1: Is there a way to isolate the rest of the framework and allow that to compile to any platform?
Question2: Assume that my framework runs in x64 mode, and during runtime I load a forced 32bit assembly. Would that work or would it throw AssemlyLoadWhateverException?

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

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

发布评论

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

评论(1

一向肩并 2024-08-30 13:38:40

答案:

  1. 如果引用的程序集都不是 32 位的,则只能编译为任何平台。
    您可以使用 Assembly.LoadFrom 加载仅 32 位的程序集,并使用反射调用它,并且仍然编译到任何平台。

  2. 那是行不通的。 编辑:它似乎有效;我不知道为什么。

Answers:

  1. You can only compile as Any Platform if none of the referenced assemblies are 32-bit only.
    You can load the 32-bit only assembly using Assembly.LoadFrom and call it using Reflection, and still compile to any platform.

  2. That will not work. EDIT: It seems to work; I'm not sure why.

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