Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.2.0 error on asp.net core 1.1.1

asp.net-core entity-framework-core

Question

I upgraded to VS2017 15.3.3 but still working on an ASP.NET MVC Core 1.1.1 project with code first approach. When following this tutorial from official ASP.NET team (that is geared more towards ASP.NET Core 2.0) when I ran the following Package Manager command (from the tutorial) I was getting compatibility error (v2.0 vs v1.1):

Install-Package Microsoft.EntityFrameworkCore.SqlServer

So, I decided to add the -version 1.1.1 as a parameter to the above command as follows and it ran successfully:

Install-Package Microsoft.EntityFrameworkCore.SqlServer -version 1.1.1

I did the same for other two related PM commands in the above mentioned tutorial and everything ran fine. But now, when I run the following PM command I get the following error:

PM> add-migration MyFirstMigration -context BloggingContext

Error

Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.2.0

.csproj File

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    <UserSecretsId>aspnet-MVC_IndvUserAccts_Test-B2520DA6-BE8D-42EE-806D-366F7C4C2E77</UserSecretsId>
  </PropertyGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" PrivateAssets="All" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" PrivateAssets="All" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.1" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
  </ItemGroup>

</Project>
1
0
9/4/2017 2:03:24 AM

Popular Answer

Recently I have faced the same issue at my office system what help me to solve the problem is:

dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design -(system assembly 2.2.1.0 which was causing the error)

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design --version 2.2.0 -the correct assemly (Target assembly that is needed to my project)

0
1/29/2019 8:15:41 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow