Running dotnet ef migration for class library gives error MSB4006

I have an ASP.NET Core Web Application (.NET Framework) project focused on the .NET Framework 4.6.2.

I injected the Entity Framework into a web project and set up and run

dotnet ef migrations add Initial

from the catalog of web projects. Migration created, all is well.

I want to reorganize the code so that my entities and the db context are in the class library instead. So I created a separate class library project (.NET Framework), also targeting the .NET Framework 4.6.2.

From the web project directory, I run

dotnet ef migrations add Initial --startup-project . --project ..\MigrationTest.Entities

where MigrationTest.Entitiesis my class library.

This time I get:

C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities\obj\MigrationTest.Entities.csproj.EntityFrameworkCore.targets(4,5): MSB4006: , "GetEFProjectMetadata". [C:\\\MigrationTestNoIdentity\MigrationTest.Entities\MigrationTest.Entities.csproj] . .NET Core MSBuild. BaseIntermediateOutputPath MSBuildProjectExtensionsPath, -msbuildprojectextensionspath.

.NET Core, .NET Core. , :

C:\Program Files\dotnet\sdk\1.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): : Project 'C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities.Core\MigrationTest.Entities.Core.csproj 'target'.NETCoreApp, Version = v1.1 '. , ".NETFramework, Version = v4.6.2". [C:\\\MigrationTestNoIdentity\MigrationTest.Entities.Core\MigrationTest.Entities.Core.csproj] C:\Program Files\dotnet\sdk\1.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): : 'C:\Projects\\MigrationTestNoIdentity\MigrationTest.Entities.Core\MigrationTest.Entities.Core.csproj. . [C:\\\MigrationTestNoIdentity\MigrationTest.Web\MigrationTest.Web.csproj]

, , Core .NET.

? ? - ?

+4

Source: https://habr.com/ru/post/1675656/


All Articles