user8164624
user8164624

Reputation:

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?

Upvotes: 0

Views: 997

Answers (2)

Heinzi
Heinzi

Reputation: 172240

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.

Upvotes: 3

Satish Hirpara
Satish Hirpara

Reputation: 76

The .NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the .NET Framework. In other words, apps and components built with previous versions will work without modification on the .NET Framework 4.5 and later versions. However, by default, apps run on the version of the common language runtime for which they were developed, so you may have to provide a configuration file to enable your app to run on the .NET Framework 4.5 or later versions.

In practice, this compatibility can be broken by seemingly inconsequential changes in the .NET Framework and changes in programming techniques. For example, performance improvements in the .NET Framework 4.5 can expose a race condition that did not occur on earlier versions. Similarly, using a hard-coded path to .NET Framework assemblies, performing an equality comparison with a particular version of the .NET Framework, and getting the value of a private field by using reflection are not backward-compatible practices.

In addition, each version of the .NET Framework includes bug fixes and security-related changes that can affect the compatibility of some apps and components. So i would suggest you to upgrade it to framework 4.7.

For more details please check: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/version-compatibility

Upvotes: -1

Related Questions