These are the steps to upgrade an ASP.NET Core MVC 3.1 web app to use .NET 6.0.
Make a new ASP.NET MVC solution
Copy files from your old VS solution to the new one.
Add dependencies/NuGet packages. In VS, in the NuGet package manager, install all the same NuGet packages you had in your old project. Make sure the version number are all 6.0.x.
Move code from Startup.cs to Program.cs
(There isn't a startup class - everything happens in the Program class.)
Add the following code right after the builder object gets instantiated - and before builder.Service.AddControllersWithViews gets called:
Set up the connection by adding this code:
xxxxxxxxxxvar connectionString = builder.Configuration.GetConnectionString("MyConnection");Where "MyConnection" is the name of your connection string.
Add the DbContext service. This example is for MySQL:
xxxxxxxxxxbuilder.Services.AddDbContext<ApplicationDbContext>(options => options.UseMySql(connectionString,Microsoft.EntityFrameworkCore.ServerVersion.AutoDetect(connectionString)));Add code to set up dependency injection into any repositories:
xxxxxxxxxxbuilder.Services.AddTransient<IReviewRepository, ReviewRepository>();Copy your test project over and add it to the solution.
That's it! Test your projects and debug anything that isn't working.