Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 961
BlackLotus Avatar asked Feb 21 '19 05:02

BlackLotus


People also ask

What is Microsoft EntityFrameworkCore design?

Microsoft. EntityFrameworkCore. Design contains all the design-time logic for Entity Framework Core. It's the code that all of the various tools (PMC cmdlets like Add-Migration , dotnet ef & ef.exe ) call into. If you don't use Migrations or Reverse Engineering, you don't need it.

What is Microsoft EntityFrameworkCore tools for?

A plugin for Microsoft. EntityFrameworkCore to support repository, unit of work patterns, and multiple databases with distributed transaction supported. For EF Core: 2, 3.


2 Answers

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

like image 125
Simon Avatar answered Jan 25 '23 04:01

Simon


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
like image 36
Taha Avatar answered Jan 25 '23 04:01

Taha