Search code examples
asp.net.netwindows-server-2012

Will application done in .net framework 4.6.1 safely work in .net framework 4.5


I done created an application in .net framework 4.6.1 which works perfectly in localhost. But in the server(Windows server 2012), we have .net framework 4.5.

Should we upgrade it to framework 4.7 or will it work in the current framework?


Solution

  • It depends on whether you use any new features introduced in .NET 4.5.1 or later or not.

    To ensure compatibility, you should either

    1. upgrade your target system to (at least) 4.6.1 or
    2. reduce the "Target Framework" setting of your project to (at most) 4.5:

      project settings screenshot

    Option 1 would ensure that all features that you use in development are available on the target system.

    Option 2 would ensure that you get a compile-time error if you use features which are unavailable in .NET 4.5.