question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migration in 2.1-preview2 fails with "Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design"

See original GitHub issue

Using the latest 2.1 preview I get this error when applying migrations through dotnet exec. Adding the package reference does not help. Same command was working in 2.0.2, see example repo.

@bricelam did not think it was related to #11437 so I opened a separate issue.

Command:
$publishDir = '..\Web\bin\Debug\netcoreapp2.1\publish\'
dotnet exec --depsfile $publishDir\Web.deps.json --additionalprobingpath $home\.nuget\packages ef.dll database update --assembly $publishDir\Web.dll --startup-assembly $publishDir\Web.dll --project-dir $publishDir --data-dir $publishDir --verbose --root-namespace Data
Exception message:
Your startup project 'Web' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.

Stack trace:
Using assembly 'Web'.
Using startup assembly 'Web'.
Using application base 'C:\Dev\netcore-dbupgrade-issue-2.1.300\Web\bin\Debug\netcoreapp2.1\publish'.
Using working directory 'C:\Dev\netcore-dbupgrade-issue-2.1.300\Data'.
Using root namespace 'Data'.
Using project directory '..\Web\bin\Debug\netcoreapp2.1\publish\'.
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. Ensure your startup project is correct, install the package, and try
again. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Design, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
   at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
   at Microsoft.EntityFrameworkCore.Tools.Commands.DatabaseUpdateCommand.Execute()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)

Steps to reproduce

Working ex. repo: https://github.com/AndersSahlin/netcore-dbupgrade-issue

Upgraded repo with issue: https://github.com/AndersSahlin/netcore-dbupgrade-issue-2.1.300

Further technical details

EF Core version: 2.1.0-preview2-final Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Win10 IDE: VS Code 1.22.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bendaycommented, Jun 21, 2018

@bricelam — is that going to be the guaranteed official path on Windows? Is there a similar official path on Linux?

1reaction
bricelamcommented, Jun 21, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Core Documents | PDF | Microsoft Visual Studio
NET Core and Entity Framework Core using Visual Studio Create Tag Helpers Create a simple view component. Develop ASP.NET Core apps using dotnet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found