I would like to generate code from a SQL Server database using scaffolding and Entity Framework Core. The project I am working with, has a dependency on COM.
When executing the following command in the terminal:
dotnet ef dbcontext scaffold "Data Source=mysource;Initial Catalog=mydb" Microsoft.EntityFrameworkCore.SqlServer
I get an error
MSB4803: The task "ResolveComReference" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild.
Of course I checked, building the project normally from Solution Explorer works fine. So, I understand the command line tool does not use the same way to build...
How can I tell dotnet ef dbcontext scaffold
command to use the right "thing" to build ?
Also, why does it need to build itself (I want to generate code, not to build it...) ?
How can I check if it connects properly to the database? I am not even sure this works, since it seems it wants to build before anything else.
I would like to generate code from a SQL Server database using scaffolding and Entity Framework Core. The project I am working with, has a dependency on COM.
When executing the following command in the terminal:
dotnet ef dbcontext scaffold "Data Source=mysource;Initial Catalog=mydb" Microsoft.EntityFrameworkCore.SqlServer
I get an error
MSB4803: The task "ResolveComReference" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild.
Of course I checked, building the project normally from Solution Explorer works fine. So, I understand the command line tool does not use the same way to build...
How can I tell dotnet ef dbcontext scaffold
command to use the right "thing" to build ?
Also, why does it need to build itself (I want to generate code, not to build it...) ?
How can I check if it connects properly to the database? I am not even sure this works, since it seems it wants to build before anything else.
Share Improve this question edited Jan 17 at 16:49 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Jan 17 at 15:27 mguijarrmguijarr 7,9306 gold badges49 silver badges74 bronze badges 3- 1 Just use EF Core Power Tools – ErikEJ Commented Jan 17 at 15:32
- Thanks @ErikEJ - what does it mean? Should I install something – mguijarr Commented Jan 17 at 15:35
- So I gave a try to EF Core Power Tools, it seems helpful however I don't know how to generate code like what I was expecting from the command line in the question – mguijarr Commented Jan 17 at 15:51
1 Answer
Reset to default 1So, I answer my own question (again !), may this helps future me or someone in the same situation...
thanks to EF Core Power Tools extension, I could test connection and have the proper
Data Source=...
instructionI used
--no-build
option to not have this build stepI had to clean and rebuild the whole project
Finally, I got the generated code as expected.