"The project 'Web' must provide a value for Configuration" error after migrating to .NET Core 3

tomRedox picture tomRedox · Sep 1, 2019 · Viewed 13.4k times · Source

I've migrated an ASP.NET Core 2.2 project to Core 3.0 and am getting the error:

The project [Project location] must provide a value for Configuration.

There's not really a lot to go on with that error message, does anyone know how to resolve this error?

This looks like it could be similar to this issue on the dotnet cli github repo.

Answer

tomRedox picture tomRedox · Sep 1, 2019

The issue turned out to be that I was still referencing Microsoft.AspNetCore.Razor.Design Version="2.2.0" in the .proj file's package references. Deleting that reference (which isn't needed at all as Razor.Design is now part of AspNetCore library) fixed the issue.

Once I'd done that, I then got hundreds of errors about nullable objects being a new feature not compatible with razor. That was because I had <LangVersion>Latest</LangVersion> in my .proj file. Removing that line fixed that issue and got the project running again.

(In some cases you might need to clean and rebuild and/or restart VS too, according to comments on the github thread)

If that doesn't solve it, it's possible that one the NuGet packages used by your project is the cause. Try removing the dependencies to see if that clears the issue, and then re-add them one at a time to work out which NuGet package is the cause.