title: Running dotnet ef migrations for class library gives error MSB4006
body: <p>I have an ASP.NET Core Web Application (.NET Framework) project targeting .NET Framework 4.6.2.</p>
  <p>I have introduced Entity Framework into the web project and have set up and run</p>
  <pre><code>dotnet ef migrations add Initial
  </code></pre>
  <p>from the web project directory. The migration is created, all is good.</p>
  <p>I want to refactor the code so that my entities and db context are in a class library instead. So I have created a separate Class Library (.NET Framework) project, also targeting .NET Framework 4.6.2.</p>
  <p>Still from the web project directory I run</p>
  <pre><code>dotnet ef migrations add Initial --startup-project . --project ..\MigrationTest.Entities
  </code></pre>
  <p>where <code>MigrationTest.Entities</code> is my class library.</p>
  <p>This time I get:</p>
  <blockquote>
  <p>C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities\obj\MigrationTest.Entities.csproj.EntityFrameworkCore.targets(4,5):
  error MSB4006: There is a circular dependency in the target dependency
  graph involving target &quot;GetEFProjectMetadata&quot;.
  [C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities\MigrationTest.Entities.csproj]
  Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project. If you're using custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.</p>
  </blockquote>
  <p>It isn't a .NET Core project, so I try creating a .NET Core project instead. Running the migrations command then gives:</p>
  <blockquote>
  <p>C:\Program
  Files\dotnet\sdk\1.0.3\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5):
  error : Project
  'C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities.Core\MigrationTest.Entities.Core.csproj'
  targets '.NETCoreApp,Version=v1.1'. It cannot be referenced by a
  project that targets '.NETFramework,Version=v4.6.2'.
  [C:\Projects\Experiments\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):
  error : Cannot find project info for
  'C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Entities.Core\MigrationTest.Entities.Core.csproj'.
  This can indicate a missing project reference.
  [C:\Projects\Experiments\MigrationTestNoIdentity\MigrationTest.Web\MigrationTest.Web.csproj]</p>
  </blockquote>
  <p>And of course, the Core project cannot be referenced by the .NET project.</p>
  <p>Is what I am trying to do a supported scenario? Is there some problem with my command line usage? Something else?</p>