2

I have three Dotnet Core 2.0 projects; Angular, Domain and EF7. Domain and EF7 are .NETStandard libraries, Angular is the Core 2.0 Angular web project template. Please note that despite the project name, EF7 is using Entity Framework Core 2.01, not Entity Framework 7.

I tried to run migrations today after some major changes (and after deleting the old migrations folder, as its still a project in development). I receive the following error:

Could not load file or assembly 'EF7, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

I am completely baffled as to where this error came from. It worked last week and I have not touched the EF packages or altered the EF7 project's properties, thus it is still built as neutral and unsigned.

This is the command I run from the command line within the EF7 folder.

dotnet ef migrations add Initial --startup-project ..\Angular

Running Add-Migration Initial from the package manager console in Visual Studio gives the same error.

The EF7 csproj file contains the requisite tools for CLI and PMC.

<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />

The project runs perfectly fine and I can view it in my browser, it is only the migration tools that fail.

Any advice?

2
  • any error message show on output window ?
    – GhostTW
    Jan 16, 2018 at 11:12
  • @GhostTW None. Just that it can't find the assembly. Jan 16, 2018 at 11:37

1 Answer 1

1

You could try this tool to find the cause of the issue: https://marketplace.visualstudio.com/items?itemName=MykolaTarasyuk.ReferenceConflictsAnalyser

2
  • 1
    So it turns out the database configuration in the web project had its assembly referenced via a magic string. Tool helped me track down that dead end. Hindsight 20/20 it feels like such a silly thing to be tripped up on. Jan 16, 2018 at 15:31
  • @benanderson89 Thanks, I had the same issue. My AddDbContext call in Startup.cs was calling MigrationsAssembly which was using the wrong string
    – Brad
    Jun 2, 2018 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.