efcore: Tools: "Your startup project doesn't reference Design" in VS 15.7

The implementation of NuGet/Home#4125 broke our Microsoft.EntityFrameworkCore.Tools package. Since it uses ExcludeAssets="Runtime", .NET Core can’t find Microsoft.EntityFrameworkCore.Design.dll at design time.

cc @jainaashish @rrelyea

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

It’s nice that users can’t compile against Microsoft.EntityFrameworkCore.Design.dll, but we still need Assembly.Load("Microsoft.EntityFrameworkCore.Design") to work…

Hi @bricelam , I have gone through all of your examples and solutions pertaining to above issue being discussed and they are really helpful since I am also trying to execute migrations against a dll, or a class library compiled to a dll, but unfortunately I have still not been able to implement or adapt your solution here: https://blog.bennymichielsen.be/2017/08/01/migrating-databases-with-ef-core-during-a-vsts-release/ . I would really appreciate if you can please go into more details and explain your approach. Following were the issues I encountered :

  1. “exec” statement didn’t work
  2. which deps.json and runtimeconfig.json are you referring to and how do you package it together in the final archive
  3. the ef.dll that is being copied/packaged in my project is still for .net core2.0 even though my csproj imports packages >=2.1.4 for .net core 2.1, which causes the same error as above “Your startup project <project name> doesn’t reference Microsoft.EntityFrameworkCore.Design”
  4. my project, containing the dbcontext, and the startup project, which contains the dbcontextfactory and migrations, are separate
  5. I want to trigger migrations during install time depending upon user input and whether db exists or not and needs to be upgraded/downgraded, via migrations, or removed and created fresh

thanks in advance

I realized it was a stupid question shortly after asking it. 😄 lol, please ignore.

Just wanted to check if the error I’m seeing is related to this issue. Running ef migrations with dotnet exec and it’s complaining about the same thing:

Microsoft.EntityFrameworkCore.Tools.CommandException: Your startup project ‘Web’ doesn’t reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work.

Haven’t had any issues with this setup before testing the 2.1 preview, and adding the reference does not help.