Warm tip: This article is reproduced from stackoverflow.com, please click
.net-core .net-core-2.1 asp.net-core-mvc visual-studio-2017

An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be create

发布于 2020-06-02 16:01:06

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?

Questioner
HelloWorld
Viewed
35
Ruard van Elburg 2018-07-02 19:57

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.