I am trying to port everything from Entity Framework 6.3 to Entity Framework Core 2.1.2 and this is my first experience with EF Core. I have 2 projects one is my core or infrastructure project with all the entity models, DB Context and repositories and the other one is an asp.Net MVC which is my startup project and using all the services from the core project. Both projects are using .NetStandard Library 2.0.3 and targeted .Net Framework 4.6.2. And I have .Net Core SDK 2.2 on my machine.
1- Converted everything to Entity Framework Core (All the entity mappings, contexts and repositories) and all the stuff seems fine, both projects build successfully.
2- starting first migration targeting existing database and entity models. Now while the migration process building both projects I am getting a strange error on asp.net MVC project as following:
An instance of analyzer Microsoft.EntityFrameworkCore.RawSqlStringInjectionDiagnosticAnalyzer cannot be created from C:\Users\user\.nuget\packages\microsoft.entityframeworkcore.analyzers\2.1.2\analyzers\dotnet\cs\Microsoft.EntityFrameworkCore.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
3- Now everytime you build the Asp.net project, you get the same error.
I really have no idea about this RawSqlStringInjectionDiagnosticAnalyzer and why this being even used by the projects, I have spent 2 days so far on this problem search all over the Internet, some people experienced somewhat similar problems (like this one) but could not found any solution, some of the stuff that I did was:
Please help me I am tired of adding and referencing different packages and binaries, I can't even grasp the problem.
I have realized this should be a warning and not an error so I found out that the "Treat warning as error" options in the project settings is enabled so that's reasons I am getting this as an error, however, still do not know the reason behind this warning.