Bin DLL 的目标可能是不同的 .NET 框架吗?

发布于 2024-09-24 19:58:04 字数 149 浏览 0 评论 0原文

我有一个当前在 .NET 3.5 下运行的网站。我正在考虑让它在4.0下运行,但是我使用许多第三方DLL来压缩,Bit.ly,Twitter,XML等。如果这些DLL是为.NET 3.5(在VS2008中)创建的,它们会继续运行吗3.5以下?或者 4.0 是否以某种方式向后兼容旧库?

I have a website that is currently running under .NET 3.5. I am thinking of making it run under 4.0, but I use many 3rd-party DLL's for compressing, Bit.ly, Twitter, XML, etc. If these DLL's were created for .NET 3.5 (in VS2008), will they continue to run under 3.5? Or is 4.0 somehow backwards compatible for old libraries?

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

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

发布评论

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

评论(2

三生殊途 2024-10-01 19:58:04

如果这些 DLL 是为 .NET 3.5(在 VS2008 中)创建的,它们会继续在 3.5 下运行吗?

不存在在 3.5 以下运行的情况。 .NET 程序集针对 .NET 版本进行编译,然后由 CLR 加载和执行。 .NET 3.5 使用 CLR 2.0,.NET 4.0 使用 CLR 4.0。

因此,如果您的应用程序在 CLR 4.0 下运行,这些程序集将在 CLR 4.0 下运行,CLR 4.0 向后兼容针对 .NET 3.5 编译的程序集。如果这些程序集调用非托管函数,可能会出现一些警告,但否则它们应该可以正常工作。

继续尝试运行它们。

If these DLL's were created for .NET 3.5 (in VS2008), will they continue to run under 3.5?

There's no such thing as running under 3.5. .NET assemblies are compiled against a .NET version and then loaded and executed by the CLR. .NET 3.5 uses CLR 2.0 and .NET 4.0 uses CLR 4.0.

So if your application is running under the CLR 4.0 those assemblies will run under the CLR 4.0 which is backwards compatible with assemblies compiled against .NET 3.5. There could be some caveats if those assemblies call unmanaged functions but otherwise they should work just fine.

Go ahead and try running them.

孤独患者 2024-10-01 19:58:04

如果它们是纯粹的托管代码,我希望它们能够在 .NET 4 下正常工作。如果它们使用非托管 API,我相信可能会出现一些问题,您可能需要重建这些问题库 - 但如果它们是开源的,那应该不是问题。

(我知道有一个数据库提供商至少直到最近才提供 .NET 3.5 DLL,并且它们不能在 .NET 4 中工作,正是因为它们通过 P/Invoke 使用非托管 API。我不知道详细信息不幸的是,该领域发生了变化 - 我倾向于像瘟疫一样避免 P/Invoke :)

If they're purely managed code, I'd expect them to work just fine under .NET 4. If they use unmanaged APIs, I believe there can be some problems, and you may need to rebuild those libraries - but if they're open source, that shouldn't be a problem.

(I know that there's one database provider who at least until recently only provided .NET 3.5 DLLs, and they didn't work in .NET 4 precisely because they used unmanaged APIs via P/Invoke. I don't know the details of what's changed in that area, unfortunately - I tend to avoid P/Invoke like the plague :)

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