最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - .NET database scaffolding: build step fails with unsupported "ResolveComReference" (.NET core vs .NET fra

programmeradmin8浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

So, I answer my own question (again !), may this helps future me or someone in the same situation...

  1. thanks to EF Core Power Tools extension, I could test connection and have the proper Data Source=... instruction

  2. I used --no-build option to not have this build step

  3. I had to clean and rebuild the whole project

Finally, I got the generated code as expected.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论