0
votes

I have downloaded sample Asp.net project from the git repository and try to build in the local machine VS 2017 below is the error it is showing

Error CS8032 An instance of analyzer Microsoft.AspNetCore.Mvc.Analyzers.AvoidHtmlPartialAnalyzer cannot be created from C:\Users\avinash.nuget\packages\microsoft.aspnetcore.mvc.analyzers\3.0.0-alpha1-10670\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. The system cannot find the file specified.. MusicStore E:\LearningTools\sampleapp\MusicStore-master\MusicStore-master\samples\MusicStore\CSC 1 Active

And here is the link for the git repo: https://github.com/aspnet/MusicStore for project reference.

What may be the issue in my machine or any missing file/lib in the framework?

1
Do a nuget restore and try restarting Visual Studio. Its a known bug that when analyzers or testrunners (for unit tests) are loaded as nuget package its required to reopen the project (or in worst case) restart visual studio, so that the analyzers get properly loaded - Tseng
Also please note, if you clone from master branch, you are getting the latest version for the latest .NET Core SDK/Runtime, right now that would be .NET Core 3.0 which is in a very very very early development stage. If you want the project for a specific .NET Core runtime, use the release/x.ytags, i.e. github.com/aspnet/MusicStore/tree/release/2.1 for .NET Core 2.1 or github.com/aspnet/MusicStore/tree/release/2.2 for .NET Core 2.2 (still preview as of time of writing) - Tseng

1 Answers

-1
votes

It seems you do not have a dot.Net core SDK installed on your machine. Try installing the SDK and verify.

Thanks, SK