Due to already end of life support of .net framework 4.0 business has planned to migrate the hosted web application that targets the 4.0 framework to 4.6.2 (EOL is 2027).
So we have asp.net web application hosted on the server (deployed binaries onto server) targetting the compilation framework 4.0 needs to migrate to 4.6.2,
My question is after changing the target framework version from 4.0 to 4.6.2 is it required to rebuild the application to achieve the goal?
Or just changing the framework version in webconfig file alone will be sufficient (without rebuild) to say the application has been upgraded from 4.0 to 4.6.2
2
Answers
Well, you can run a 4.0 application against a newer framework (which probably already happens, because all recent computers have only 4.8 installed), but no, this is not considered an update. That requires a rebuild.
But: Why would you want to upgrade from stone age to bronze age? The current .NET Framework version is 4.8.1, and anything older is out of support. Most applications will even easily update to .NET 6.0, and unless you are using components no longer supported, that is the way forward.
Microsoft recommends you review the following documents before you migrate your app from earlier versions of .NET Framework to version 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, or 4.8.1.
Refer to the NET Framework Migration Guide for further information – these are the docs you want to be familiar with when you are planning an upgrade like this one.
To answer your specific question the documentation about version compatibility states that
Again, refer to the same documentation for further information. There is some detailed information here about how a version of the .Net runtime will be activated for the app to run on. But I think you can take this mean that you may or may not succeed if you try to run your application on a framework that it was not compiled (or tested) against. On the other hand – you can "test in production" and see what happens 😉