What changes are needed for .NET framework upgrade from 4.6 to 4.8

3k views Asked by At

I am working on project upgrade for the 1st time. I have a solution built upon 4.6 version of .NET framework. When I opened it very first time in VS 2022, I got a dialog box saying upgrade to 4.8 and I clicked OK on that. Now I can see that my application is running on 4.8.

  1. I am confused and curios to know about what all other things are I need to check to make sure my application is running on .NET 4.8 version.
  2. I can see that my .csproj file is updated automatically. .Csproj file contains the TargetFrameworkVersion updated to 4.8.
  3. I can see new package.config file is newly added to solution. It is containing all the package references.
  4. In web.config also contains the changes tag.

Do I need to check in all these 3 files in git or just .csproj file?

Thanks in advance.

3

There are 3 answers

4
rotabor On

.NET Framework 4.8 is the latest supported release. It installs with VS if the framework support option is selected. But you are not forced to upgrade your app. Just install .NET Framework 4.6 and continue to work.

If you already upgraded your app and don't want to come back to 4.6, you can synchronize your local files with git.

4
PMF On

There are no breaking changes between .NET Framework 4.6 and .NET Framework 4.8. So it is not expected that you see any problems compiling and running your application. The installed runtime version is 4.8 on any computer running something later than Windows 7 anyway. So you have been running your application against the .NET 4.8 runtime for a long time already.

This will be different if you decide to update to .NET 6.0 or later. There are some breaking changes there, but for most applications, even that is doable with reasonable effort.

0
sfwgeek On
  1. Q: Do I need to check in all these 3 files in git or just .csproj file?
    • A: Yes. The below files should be version controlled as they will change when adding/deleting code files (.csproj), when adding new references to NuGet pkgs (.csproj/package.config) and web app cfg changes (web.config). If in doubt, add them to code repo. Can learn when they change as you go. Only files not worth adding to code repo are ones which are auto generated by compiler like .exe files.
      1. .csproj - project details like code files.
      2. package.config - details of NuGet packages used by project.
      3. web.config - details about web app cfg like db connection string etc.

The following may also give you more background about migrating code from .NET Framework 4.6.1 to 4.8. You asked about v4.6 but v4.6.1 is very similar.

Running 4.6.1 application on 4.8 framework: What issues will I encounter