An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\
Asked Answered
O

4

18

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?

Oligopsony answered 28/6, 2018 at 8:1 Comment(0)
C
16

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.

Crashing answered 2/7, 2018 at 11:57 Comment(0)
A
10

This is my simple solution:

Unload Project -> Reload Project -> Rebuild -> Done!

Adnate answered 19/3, 2020 at 10:18 Comment(2)
This option should be the first step for anyone with the issue.Limestone
This option worked for me... I unloaded, then Reloaded, rebuild, and finally updated Microsoft.EntityFramworkCore and that did the trick... Thank you @AdnateThorite
R
3

uninstall & installing Nuget of Microsoft.AspNetCore will resolve the issue

Ridglee answered 22/10, 2019 at 6:45 Comment(0)
J
0

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.

Jehu answered 10/1 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.