简体   繁体   English

从 .NET Framework 2.0 迁移到 4.5.2

[英]Migration from .NET framework 2.0 to 4.5.2

We have an application with around 300+ components (dll's and a couple of exe's).我们有一个包含大约 300 多个组件(dll 和几个 exe)的应用程序。 Some of them target 4.0 framework, some use 2.0 framework, some are written in native C++ (unmanged), some uses C++/CLI and a couple of them are written in ManagedExtensions for C++.其中一些针对 4.0 框架,一些使用 2.0 框架,一些使用原生 C++(非托管)编写,一些使用 C++/CLI,还有一些使用 ManagedExtensions for C++ 编写。

Now our requirement is to migrate to .NET Framework 4.5.2.现在我们的要求是迁移到 .NET Framework 4.5.2。

So my question is:所以我的问题是:

Will it be OK if I just change the TargetFramework version on all the exe's to 4.5.2 with out changing the dll's TargetFramework version?如果我只是将所有 exe 上的 TargetFramework 版本更改为 4.5.2 而不更改 dll 的 TargetFramework 版本,是否可以?

Does it guarantee that all my dll's are loaded and run in 4.5.2 runtime?它是否保证我所有的 dll 都在 4.5.2 运行时加载并运行? (Included all the C++ dll's). (包括所有的 C++ dll)。

I have gone through multiple articles on internet and I could not find a concrete answer in the scenario where we have a mix of C#, managed c++ and unmanaged c++ dlls.我在互联网上浏览了多篇文章,但在我们混合使用 C#、托管 c++ 和非托管 c++ dll 的情况下,我找不到具体的答案。 Any help is appreciated.任何帮助表示赞赏。

Edit: Our team generate core libraries (sort of a framework) and few executables (targetted to 2.0 framework) which can be used by various other teams to meet their customer specific requirements.编辑:我们的团队生成核心库(某种框架)和少量可执行文件(针对 2.0 框架),可供其他各种团队使用以满足其客户的特定要求。 Some of the customers are not yet migrated from XP (Max .NET framework used in XP is 4.0).一些客户尚未从 XP 迁移(XP 中使用的 Max .NET 框架为 4.0)。 So along with newer OS's we still need to support clients using XP.因此,随着更新的操作系统,我们仍然需要支持使用 XP 的客户端。

While 2.0 projects are generally upgradable to 4.5.x with no code changes, there are breaking-differences between .NET versions that you may run into.虽然 2.0 项目通常无需更改代码即可升级到 4.5.x,但您可能会遇到 .NET 版本之间的重大差异。 Given the scale and complexity of your project I must advise against blindly changing the TargetFramework property and hoping for the best.鉴于您的项目的规模和复杂性,我必须建议不要盲目更改TargetFramework属性并希望获得最佳效果。

While 4.0 executables can load 2.0 DLLs, it is not recommended because of the breaking-changes I described.虽然 4.0 可执行文件可以加载 2.0 DLL,但由于我描述的重大更改,不建议这样做。

You will run into problems with the mixing of C++ code.遇到混合 C++ 代码的问题。 I recommend you start by upgrading (or rather, rewriting) your "Managed Extensions for C++" code to C++/CLI (you might want to take advantage of C++11 and C++14 features present in VS2015 while you're at it).我建议您首先将“C++ 托管扩展”代码升级(或更确切地说,重写)到 C++/CLI(您可能希望在使用 VS2015 时利用 C++11 和 C++14 功能它)。

I recommend upgrading each project individually and separately, working your way up the dependency-chain.我建议单独和单独升级每个项目,按照您的方式向上依赖链。 It will help if you have (or will write) unit tests and integration tests for more critical parts of your system.如果您已经(或将要编写)单元测试和集成测试来针对系统的更关键部分,这将有所帮助。

Migrating from 2.0 to 4.5.2 is just click click job, whereas no gaurantee thay it wont break anything.从 2.0 迁移到 4.5.2 只是单击单击作业,而没有保证它不会破坏任何东西。 Recently I upgraded a webapplication to 4.5.2 and there were requestvalidation issue,3rd party tool broke and what not.最近我将一个 web 应用程序升级到 4.5.2 并且有 requestvalidation 问题,3rd 方工具坏了等等。

So one cannot say it will work seamlessly, you have to test it out to see if it works.因此,不能说它会无缝运行,您必须对其进行测试以查看它是否有效。

Now mixing 2.0 with 4.5.2 may cause chaos as you need to take into account consuming application too at the time of writing code.现在将 2.0 与 4.5.2 混合可能会导致混乱,因为您在编写代码时也需要考虑使用应用程序。

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

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