隔离强制 32 位程序集
给定一个用 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案:
如果引用的程序集都不是 32 位的,则只能编译为任何平台。
您可以使用
Assembly.LoadFrom
加载仅 32 位的程序集,并使用反射调用它,并且仍然编译到任何平台。那是行不通的。编辑:它似乎有效;我不知道为什么。Answers:
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.That will not work.EDIT: It seems to work; I'm not sure why.