Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Entity Framework Analyzer couldn't be found

I'm using VS2022 to use .NET6 and I am receiving some errors about analyzers not being able to be created in a NUnit3 test project.

Error CS8032 An instance of analyzer Microsoft.EntityFrameworkCore.InternalUsageDiagnosticAnalyzer cannot be created from .nuget\packages\microsoft.entityframeworkcore.analyzers\7.0.1\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

Error CS8032 An instance of analyzer Microsoft.EntityFrameworkCore.UninitializedDbSetDiagnosticSuppressor cannot be created from .nuget\packages\microsoft.entityframeworkcore.analyzers\7.0.1\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

Any ideas?

like image 979
Garry A Avatar asked May 14 '26 12:05

Garry A


1 Answers

According to the discussion on issue #61333 (Version Microsoft.CodeAnalysis 4.2.0 doesn't work) on the Roslyn repository it's a matter of .NET SDK version.

So updating to a newer version of your SDK may fix your issue.

like image 168
0xced Avatar answered May 19 '26 01:05

0xced



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!