Reputation: 635
I'm updating a VS2017 to use ASP.NET Core 2.1 (installing dot.net core sdk 2.1 and Microsoft.Net.Compilers 2.8.2) and I am receiving some warnings about analyzers not being able to be created after creating a new ASP.net core mvc 2.1 project.
Warnings:
Warning CS8032 An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.analyzers\2.1.1\analyzers\dotnet\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Can not find the specified file.
Warning CS8032 An instance of analyzer Microsoft.EntityFrameworkCore.RawSqlStringInjectionDiagnosticAnalyzer cannot be created from C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore.analyzers\2.1.1\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Can not find the specified file.
Any suggestions how to solve this problem?
Upvotes: 18
Views: 21808
Reputation: 1
I had similar errors but I wasn't using Visual Studio (using VS Code). Short of uninstalling Nuget, I cleared the local nuget cache and that worked. From the dotnet command line: dotnet nuget locals all --clear. Solved.
Upvotes: 0
Reputation: 109
This is my simple solution:
Unload Project -> Reload Project -> Rebuild -> Done!
Upvotes: 10
Reputation: 29
uninstall & installing Nuget of Microsoft.AspNetCore will resolve the issue
Upvotes: 3
Reputation:
I received the same message after installing dotnet-sdk-2.1.301.
Updating Visual Studio to the latest version (15.7.4) fixed it for me.
Upvotes: 16