skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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.

    • See Versions and Dependencies
      to understand the CLR version underlying each version of the .NET
      Framework and to review guidelines for targeting your apps
      successfully.
    • Review Application compatibility
      to find out about runtime and retargeting changes that might affect
      your app and how to handle them.
    • Review What’s Obsolete in the Class Library
      to determine any types or members in your code that have been made
      obsolete, and the recommended alternatives.
    • See What’s New
      for descriptions of new features that you may want to add to your app.

    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

    by default, an app runs on the version of .NET Framework that it was
    built for. If that version isn’t present and the app configuration
    file doesn’t define supported versions, a .NET Framework
    initialization error may occur. In this case, the attempt to run the
    app will fail.

    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 😉

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search