You will want to target .NET 8, which is the latest version. Using .NET 6 is not recommended because it is out of support (see Microsoft .NET and .NET Core Lifetime Policy).
First, assess the project dependencies to ensure they make sense. I've worked on applications where class libs depended on web projects, and separate web API projects depended on each other. You need to ensure your solution does not have circular dependencies. Visual Studio does a pretty good job of this, but circular dependencies can sneak in if there are enough levels of separation between projects. Don't be afraid to crack open a Visio diagram (or some similar tool) to visually map these dependencies if necessary. If you find indirect circular dependencies between projects, your first order of business is to break these circular dependencies. The rest of the upgrade will go much smoother and allows to selectively upgrading projects, which I believe to be one of your main goals.
The low-hanging fruit for your upgrade will be class libraries that are not directly coupled to the .NET Framework. We use .NET Standard 2.0 for class libraries in one of my projects, because they work with .NET Framework 4.6+ and .NET Core/.NET 5+ projects. Generally speaking, the lower the .NET Standard version number the more .NET runtimes that are compatible. So really, step 1 is to convert class libs to .NET Standard 2.0 and upgrade the other projects to .NET 4.8.x. The upgrade from .NET 4.5 to 4.8 should require minimal effort.
Next step is to upgrade test projects that only rely on those class libs and NuGet packages. These are usually pretty easy and safe to upgrade to the latest version of .NET. The most troubles I've had concerned upgrading NuGet packages, but this is very dependent on the NuGet packages you have installed.
Finally, upgrade projects that are tied to the .NET framework. These are things like web and web API projects, Windows services and console applications. This is where project dependencies begin to matter.
Roughly, these are the steps to take:
- Break indirect circular dependencies between projects.
- Upgrade projects to .NET 4.8 which still receives security fixes and supports .NET Standard 2.0.
- Upgrade class libs to .NET Standard 2.0, which works on .NET 4 and .NET Core/.NET 5+.
- This will include hunting down newer versions of 3rd party NuGet packages which are compatible with .NET 4.8 and .NET Standard.
- I've run into a slight snag using FluentValidation. It looks like the v8 series of FluentValidation is the last one that had good integration with .NET Framework 4 ASP.NET MVC applications. You can upgrade to the latest version of FluentValidation for those projects, but you lose client-side validations. Properly done, this is an inconvenience for the end user and should be resolved once you upgrade to .NET 8.
- Upgrade test projects for the .NET Standard class libs to the latest .NET version.
- And then upgrade any CI/CD pipelines you use as well.
- Upgrade the remaining projects which are tightly coupled to .NET 4.
- Again, CI/CD pipelines will likely be impacted by this.
Some other considerations:
- With 80 projects in one solution, dependencies might be difficult to untangle. Analyze which ones are cohesive, and consider upgrading the whole group of projects at once.
- Automated tests are you friends. If you don't have good test coverage, consider writing tests first before attempting to upgrade. They can be unit tests, integration tests, or end-to-end tests. The important thing is that you have tests.
Planning For The Future
Once you've done the big lift-and-shift into the new framework, you can retarget the .NET Standard libraries to .NET 8, however .NET Standard will continue being supported moving forward. Changing from .NET Standard to .NET 8 should only be necessary if your application needs to utilize APIs that are not available in .NET Standard.
Limitations Of This Approach
I have not needed to deal with C++ projects yet. The available .NET framework APIs and any third party libraries will be the major hurdles with upgrading C++ projects. I don't have a lot of advice here due to a lack of experience on this front.