简体   繁体   English

.Net 3.5 Dll在.Net 4.0应用程序中的任何问题

[英].Net 3.5 Dll's in a .Net 4.0 application any issues

We are planning to move a legacy application which uses enterprise library 4.1 which uses .Net 3.5 in a .Net 4.0 web application. 我们计划移动使用企业库4.1的遗留应用程序,该应用程序在.Net 4.0 Web应用程序中使用.Net 3.5。

We are wondering will this cause any performance problems? 我们想知道这会导致任何性能问题吗? Will the .net 3.5 code run in a different application pool? .net 3.5代码是否会在不同的应用程序池中运行?

I have finally found answer to this. 我终于找到了答案。 The performance problem I previously mentioned my team discovered is due to something else. 我之前提到的团队发现的性能问题是由于其他原因造成的。 Not loading .NET 3.5 on .NET 4.0 App Domain. 不在.NET 4.0 App Domain上加载.NET 3.5。

Reading this article: http://msdn.microsoft.com/en-us/magazine/ee819091.aspx 阅读本文: http//msdn.microsoft.com/en-us/magazine/ee819091.aspx

In-Proc SxS does not solve the compatibility problems faced by library developers. In-Proc SxS无法解决库开发人员面临的兼容性问题。 Any libraries directly loaded by an application--either via a direct reference or an Assembly.Load--will continue to load directly into the runtime and AppDomain of the application loading it. 由应用程序直接加载的任何库(通过直接引用或Assembly.Load)将继续直接加载到加载它的应用程序的运行时和AppDomain中。 This means that if an application is recompiled to run against the .NET Framework 4 runtime and still has dependent assemblies built against .NET 2.0, those dependents will load on the .NET 4 runtime as well. 这意味着如果重新编译应用程序以针对.NET Framework 4运行时运行,并且仍然具有针对.NET 2.0构建的依赖程序集,那么这些依赖项也将加载到.NET 4运行时。 Therefore, we still recommend testing your libraries against all version[s] of the framework you wish to support. 因此,我们仍然建议您针对您希望支持的框架的所有版本测试您的库。 This is one of the reasons we have continued to maintain our high level of backward compatibility. 这是我们继续保持高水平向后兼容性的原因之一。

So, there's no problem loading .NET 3.5 assemblies directly into .NET 4.0 apps without recompiling them into .NET 4.0. 因此,将.NET 3.5程序集直接加载到.NET 4.0应用程序中而不将它们重新编译到.NET 4.0中是没有问题的。

4.0 is a superset of 3.5 so there should be no challenges. 4.0是3.5的超集,所以应该没有挑战。 All of you 3.5 code will work as it had when built with VS 2008. You need to follow this first 你们所有人的3.5代码都可以像使用VS 2008一样工作。你需要先遵循这个
There is a MSDN link What's New in the .NET Framework 4 有一个MSDN链接.NET Framework 4中什么新功能
Migration Guide to the .NET Framework 4 .NET Framework迁移指南4
.NET Framework 4 RTM Application Compatibility Walkthrough .NET Framework 4 RTM应用程序兼容性演练

If you do a Google search you'll find many articles titled something like "What's new in 2010". 如果您进行Google搜索,您会发现许多文章的标题为“2010年的新内容”。 You won't find things like "What's Different" 你找不到像“有什么不同”之类的东西

Except for this little tidbit From MSDN: 除了来自MSDN的这个小花絮:

The .NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions, except for some changes that were made to improve security, standards compliance, correctness, reliability, and performance. 除了为提高安全性,标准合规性,正确性,可靠性和性能而进行的一些更改之外,.NET Framework 4与使用早期.NET Framework版本构建的应用程序高度兼容。

The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. .NET Framework 4不会自动使用其公共语言运行库版本来运行使用早期版本的.NET Framework构建的应用程序。 To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio, or you can specify the supported runtime with the Element in an application configuration file. 要使用.NET Framework 4运行较旧的应用程序,必须使用Visual Studio中项目属性中指定的目标.NET Framework版本编译应用程序,或者可以使用应用程序配置文件中的Element指定支持的运行时。


You question whether there will be performance issues cannot be generally answered as it depends on what your code is doing. 您怀疑是否会出现性能问题通常无法解决,因为这取决于您的代码正在做什么。 Most likely you won't see any issues. 很可能你不会看到任何问题。

Although Microsoft did a lot to remain backwards compatible with the previous version of the runtime you should be aware that there are several breaking changes. 虽然Microsoft做了很多工作以保持向后兼容以前版本的运行时,但您应该知道有几个重大变化。 You will find them documented in MSDN here: 您将在MSDN中找到它们:

.NET Framework 4 Migration Issues (including documentation on ASP.NET, .NET Core, Data/ADO.NET, WCF, WPF and XML) .NET Framework 4迁移问题 (包括有关ASP.NET,.NET Core,Data / ADO.NET,WCF,WPF和XML的文档)

Microsoft also provides guidance and links to further migration planning tasks: Microsoft还提供指导和指向进一步迁移规划任务的链接:

Migration Guide to the .NET Framework 4 .NET Framework迁移指南4

As you should be prepared for any issues, don't forget to schedule some time for additional testing. 由于您应该为任何问题做好准备,不要忘记安排一些时间进行其他测试。

Plan to do you own perf testing. 计划你自己进行性能测试。 For guidance, see this from the patterns & practices. 作为指导,请参阅从模式与实践。

I don't know which blocks you are using, but you should consider migrating to EntLib v5.0, since there were major perf improvements in the logging application block as well as a refactoring/cleanup of the underlying infrastructure. 我不知道您正在使用哪些块,但您应该考虑迁移到EntLib v5.0,因为日志应用程序块中的主要性能改进以及底层基础架构的重构/清理。 Check out the Migration Guide for Enterprise Library 5.0 . 查看Enterprise Library 5.0迁移指南

Well it shouldn't have any performance problems. 那么它不应该有任何性能问题。 However, one major difference is that .Net 4.0 comes with a different runtime which may introduce some differences. 但是,一个主要的区别是.Net 4.0带有不同的运行时,可能会带来一些差异。

.NET 3.5 DLLs are loaded in separate app domain than .NET 4. So, all calls to .NET 3.5 DLLs from .NET 4 will be across app domain. .NET 3.5 DLL加载在与.NET 4不同的应用程序域中。因此,从.NET 4对.NET 3.5 DLL的所有调用都将跨越应用程序域。 That means quite some overhead. 这意味着一些开销。 Unless you can rebuild the 3.5 source code in .net 4, I would not recommend using it. 除非您可以在.net 4中重建3.5源代码,否则我不建议使用它。 One of my team tried that and then they saw pretty bad performance so they went back to .NET 3.5. 我的一个团队尝试过,然后他们看到了相当糟糕的性能,所以他们又回到了.NET 3.5。 Until we get source code for all .net 3.5 DLLs or vendors release .net 4 DLLs we aren't going to upgrade our code base to net 4. 在我们获得所有.net 3.5 DLL或供应商发布.net 4 DLL的源代码之前,我们不会将我们的代码库升级到net 4。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM