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

前端 未结 5 569
一个人的身影
一个人的身影 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条回答
  •  [愿得一人]
    2020-12-03 04:18

    And I quote:

    "The .NET Framework 4 is backward-compatible with applications that were built with the .NET Framework versions 1.1, 2.0, 3.0, and 3.5. In other words, applications and components built with previous versions of the .NET Framework will work on the .NET Framework 4."

    Taken from Version Compatibility in the .NET Framework

    You have the right idea with the App.config file, but your really limiting yourself with the one line.
    Might I suggest a more liberal use of supportedRuntime lines?

    For example:

    
    
      
        
        
        
        
        
        
        
        
        
         
        
      
    
    

    Why is supportedRuntime version="v3.5" commented out? Remember, this configuration identifies which versions of the Common Language Runtime (CLR) your application is compatible with. There is no 3.0 or 3.5 version of the CLR. Refer to .NET Framework Versions and Dependencies

提交回复
热议问题