BlackLotus
BlackLotus

Reputation: 553

Your startup project 'project' doesn't reference Microsoft.EntityFrameworkCore.Design

I'm building WPF application with the EntityFrameworkCore version 2.2.2

However, when i want to Add-Migration it output me an error...

Your startup project 'project' 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.

I don't know why this is happen, because I can use it before this error come up.

This is my packages.config file

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Costura.Fody" version="3.3.2" targetFramework="net461" />
  <package id="Fody" version="4.0.2" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.CSharp" version="4.5.0" targetFramework="net461" />
  <package id="Microsoft.Data.Sqlite.Core" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.DotNet.PlatformAbstractions" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Abstractions" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Analyzers" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Design" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Relational" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Sqlite" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Sqlite.Core" version="2.2.2" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Tools" version="2.2.2" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration.Binder" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.DependencyModel" version="2.1.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
  <package id="Remotion.Linq" version="2.2.0" targetFramework="net461" />
  <package id="SQLitePCLRaw.bundle_green" version="1.1.12" targetFramework="net461" />
  <package id="SQLitePCLRaw.core" version="1.1.12" targetFramework="net461" />
  <package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.12" targetFramework="net461" />
  <package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.12" targetFramework="net461" />
  <package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.12" targetFramework="net461" />
  <package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.12" targetFramework="net461" />
  <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
  <package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.5.0" targetFramework="net461" />
  <package id="System.Interactive.Async" version="3.2.0" targetFramework="net461" />
  <package id="System.Memory" version="4.5.1" targetFramework="net461" />
  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.1" targetFramework="net461" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="net461" />
</packages>

The package is already installed.

NuGet Package Manager

Thanks a lot for any helps.

Upvotes: 10

Views: 20276

Answers (5)

Arhman Nadap
Arhman Nadap

Reputation: 27

Your startup project 'Lmss.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. enter image description here

During the migration, this error shows you need to install Microsoft.EntityFrameworkCore.Design in your startup project. This will help you to run the migration.

Install this: enter image description here

Upvotes: 0

B&#252;nyamin ASLAN
B&#252;nyamin ASLAN

Reputation: 1

I faced the same Problem. You have to change startup project. Whichever project you want to migrate, make it a startup project. Then set as package manager console default project. Finally, you can add migration. Like : add-migration initial

Upvotes: 0

Candice
Candice

Reputation: 92

Install it again using PMC and then it will find the reference:

PM> dotnet add package Microsoft.EntityFrameworkCore.Design

Upvotes: 4

Taha
Taha

Reputation: 1242

I did install it using this command and it works !

I'm using .net core version 3.1.1

dotnet add package Microsoft.EntityFrameworkCore.Design --version 3.1.1

Upvotes: 6

Simon
Simon

Reputation: 34840

Add-Migration may be getting confused since you are using Costura to embed assemblies. Try removing costura to see if that resolves the issue.

Upvotes: 7

Related Questions