Allow C# application built with .NET 2.0 to run on .NET 4.0/4.5

前端 未结 5 578
一个人的身影
一个人的身影 2020-12-03 03:22

We have a C# DLL (let\'s call it myapp.exe) built with .NET 2.0 Framework (VS2005) and we found out that our application won\'t work on machines where only .NET

5条回答
  •  Happy的楠姐
    2020-12-03 04:13

    Just setting web.config to supportedRuntime version="v4.0.30319"/ is not going to be enough.

    You need to actually open up your project in Visual Studio, change its target framework (properties-->build) to 4.0 - and THEN redploy the built solution to your 4.0 clients. Several system assemblies are different between 2.0 and 4.0 (system.web etc..) - although, as the previous answer suggested, backwards compatibility has been provided.

    The only way to consistently provide your clients with an actuual '4.0 compatible' version, is to compile it against a 4.0 runtime. This will entail upgrading any 3rd party, open source libraries to their 4.0 versions as well.

提交回复
热议问题