0

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.

enter image description here

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!

exlnt
  • 293
  • 3
  • 20

1 Answers1

0
  1. Your NuGet packages may have been invalid according to your target framework. Check all your recent NuGet packages for .NET Core versions.
  2. Clear your NuGet cache as shown in the picture enter image description here

Update: Delete all bin & obj folders.

Alper Ebicoglu
  • 8,884
  • 1
  • 49
  • 55
  • I have already done both of the steps. I ran dotnet clean and dotnet restore from CLI and still it does not make difference. I dont get any errors during package restore. – exlnt Aug 06 '18 at 20:54
  • try deleting all bin & obj folders. the remaining older version files might interfere with the new ones. I added a batch file to do it automatically. put the batch file in the root of your project where your *.sln file is – Alper Ebicoglu Aug 07 '18 at 06:46
  • I deleted bin and obj folder from each and every project in the solution. Then tried to add new controller, no difference, still getting same error. It's ok. I will learn to live with the issue and just keep using copy/paste from existing controllers. – exlnt Aug 09 '18 at 21:44