Upgrading large solution to .NET 6

Viewed 705
3 Answers

I used to do it with the "replace-in-files option" and NuGet-Manager in Visual Studio. Worked out for me in a 181 projects solution.

  1. Open any *.csproj-file
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>
  1. Press Shift+Ctrl+H enter image description here

  2. Open NuGet-Manager for Solution (not project itself). Select all packages and update them all (if possible, else leave out the once you know are not compatible)

You could try this PowerShell script that that upgrade all csproj-files from .NET 5 to .NET 6, including NuGet-packages:

https://gist.github.com/pekspro/24fca2eb1cad8c30333a910b163a3f6a

On the same location there is a script that downgrades to .NET 5. But do not trust this, make sure you have a backup if something goes wrong.

Related