title: Trying to install EF Core with Portable Class Library targeting .Net 4.6.1
body: <p>This is my first time experimenting with EF Core, ASP Net Core and Portable Class Libraries with VS2015.  Fair to say I am getting frustrated.</p>
  
  <p>I want to create a library where I can install EntityFramework.Core.  This library needs to be used in a WPF Application and an ASP NET Core Web Application - ignoring any good layered application concepts for now.  My thought was to create a Portable Class Library.</p>
  
  <p>Using the project template where I target .NET 4.6 and ASP Net Core... </p>
  
  <p><a href="https://i.stack.imgur.com/0kqJN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0kqJN.png" alt="Targets"></a></p>
  
  <p>I get a project with a class and a project.json file as follows:</p>
  
  <pre><code>{
      "supports": {
          "net46.app": {},
          "dnxcore50.app": {}
      },
      "dependencies": {
          "Microsoft.NETCore": "5.0.0",
          "Microsoft.NETCore.Portable.Compatibility": "1.0.0"
      },
      "frameworks": {
          "dotnet": {
              "imports": "portable-net452"
          }
      }
  }
  </code></pre>
  
  <p>Now when I install EntityFramework.Core package from nuget... </p>
  
  <p><a href="https://i.stack.imgur.com/EPRHl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EPRHl.png" alt="Install EF Core Nuget"></a></p>
  
  <p>...I get the following output:</p>
  
  <pre><code>Restoring packages for 'Acme.PCLEFClassLib'.
  Restoring packages for K:\TFS\TestApps\Projects\DotNetCore\Acme.PCL1\Acme.PCL1\project.json...
  Detected package downgrade: System.Reflection from 4.1.0-beta-23225 to 4.0.10 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; EntityFramework.Core (&gt;= 7.0.0-rc1-final) -&gt; Microsoft.Extensions.DependencyInjection.Abstractions (&gt;= 1.0.0-rc1-final) -&gt; System.Reflection (&gt;= 4.1.0-beta-23225) 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; EntityFramework.Core (&gt;= 7.0.0-rc1-final) -&gt; System.Reflection (&gt;= 4.0.10)
  Detected package downgrade: System.Reflection from 4.1.0-beta-23225 to 4.0.10 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; EntityFramework.Core (&gt;= 7.0.0-rc1-final) -&gt; Microsoft.Extensions.Logging.Abstractions (&gt;= 1.0.0-rc1-final) -&gt; System.Reflection (&gt;= 4.1.0-beta-23225) 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; EntityFramework.Core (&gt;= 7.0.0-rc1-final) -&gt; System.Reflection (&gt;= 4.0.10)
  Version conflict detected for System.Collections. 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; EntityFramework.Core (&gt;= 7.0.0-rc1-final) -&gt; System.Collections (&gt;= 4.0.11-beta-23516) 
   Acme.PCLEFClassLib (&gt;= 1.0.0) -&gt; Microsoft.NETCore.Portable.Compatibility (&gt;= 1.0.0) -&gt; Microsoft.NETCore.Runtime (&gt;= 1.0.0) -&gt; Microsoft.NETCore.Runtime.CoreCLR-x86 (&gt;= 1.0.0) -&gt; System.Collections (= 4.0.10).
  EntityFramework.Core 7.0.0-rc1-final is not compatible with .NETPlatform,Version=v5.0.
  Some packages are not compatible with .NETPlatform,Version=v5.0.
  Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0.
  Remotion.Linq 2.0.1 is not compatible with DNXCore,Version=v5.0.
  Some packages are not compatible with DNXCore,Version=v5.0.
  Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0 (win7-x86).
  Remotion.Linq 2.0.1 is not compatible with DNXCore,Version=v5.0 (win7-x86).
  Some packages are not compatible with DNXCore,Version=v5.0 (win7-x86).
  Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0 (win7-x64).
  Remotion.Linq 2.0.1 is not compatible with DNXCore,Version=v5.0 (win7-x64).
  Some packages are not compatible with DNXCore,Version=v5.0 (win7-x64).
  Package restore failed for 'Acme.PCLEFClassLib'.
  Package restore failed. Rolling back package changes for 'Acme.PCLEFClassLib'.
  ========== Finished ==========
  </code></pre>
  
  <p>Is it actually possible to install EF Core in a Portable Class Library?  If so how - what do I need to do with the project?  </p>
  
  <p>I just feel I am going round in circles looking for solutions on line.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Tried installing EntityFramework.MicrosoftSqlServer in my PCL.  </p>
  
  <p>Given that EntityFramework.MicrosoftSqlServer is installed when creating a standard ASP Net Core project - which uses the dnxcore50 framework.  How come if I do similar in the PCL, is complains that:</p>
  
  <pre><code>EntityFramework.MicrosoftSqlServer 7.0.0-rc1-final is not compatible with .NETPlatform,Version=v5.0.
  </code></pre>
  
  <p>If that is the case then how come it installs into a ASP NET Core project.  </p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I created a new PCL targeting .NET 4.5.1.  I then installed EntityFramework.MicrosoftSqlServer 7.0.0-rc1-final into that via Nuget, and it installs no problem.  Although I cannot repeat this now.  I've just created a separate solution with a PCL Library project targeting ASP NET Core and .NET 4.5.1.  This outputs the following now:</p>
  
  <pre><code>Attempting to gather dependency information for package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final' with respect to project 'AnotherPCLEFFUP', targeting '.NETPortable,Version=v4.5,Profile=Profile75'
  Attempting to resolve dependencies for package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final' with DependencyBehavior 'Lowest'
  Resolving actions to install package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final'
  Resolved actions to install package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final'
  Install failed. Rolling back...
  Package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final' does not exist in project 'AnotherPCLEFFUP'
  Package 'EntityFramework.MicrosoftSqlServer.7.0.0-rc1-final' does not exist in folder 'K:\TFS\TestApps\Projects\DotNetCore\AnotherPCLEFFUP\packages'
  Invalid portable frameworks.
  </code></pre>
  
  <p>Same happens installing EntityFramework.Core.7.0.0-rc1-final.</p>
  
  <p>Fair to say, this is utterly frustrating.  Maybe I am barking up the wrong tree or just barking mad today.</p>