问题
After about 6 months, I returned to work on my AspNetZero solution based on .NET Core 2.0. I have the original downloaded version and the modified version as separate GIT repositories. In both versions/repositories when I try to add a new MVC controller, I keep getting the below error message.
On my PC I have all of the .NET Core SDKs installed from 1.0 right up to 2.1.302. I have other projects that I am working on, where I'm using .NET Core 2.1.
I even created a brand new .NET Core 2.0 project in VS2017 and I am able to scaffold a new MVC controller without any errors. This issue is only happening on the AspNetZero solution.
I have done many searches for a solution and none of the answers I found online have worked. I just added a global.json file into my solution folder and set the SDK to 2.0.0 and tried again, still does not work. I keep getting the same error!
回答1:
- Your NuGet packages may have been invalid according to your target framework. Check all your recent NuGet packages for .NET Core versions.
- Clear your NuGet cache as shown in the picture
Update: Delete all bin & obj folders.
来源:https://stackoverflow.com/questions/51697823/aspnetzero-net-core-2-0-mvc-version-error-on-adding-new-controller