Migration in 2.1-preview2 fails with "Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design"
See original GitHub issueUsing 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:
- Created 5 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bricelam — is that going to be the guaranteed official path on Windows? Is there a similar official path on Linux?
cc @benday