32
votes

I'm trying to update to NET Core 2.0 but I'm getting these errors on all the packages installed with the reference.

The problem, maybe:

I'm getting a reference to netcoreapp1.0 in the output:

The Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0 package is not compatible with netcoreapp1.0 (.NETCoreApp, Version = v1.0). The Microsoft.EntityFrameworkCore.Tools.DotNet 2.0.0 package supports: netcoreapp2.0 (.NETCoreApp, Version = v2.0) One or more packages are not compatible with .NETCoreApp, Version = v1.0. Detection of detected package: Microsoft.ApplicationInsights.AspNetCore from 2.1.1 to 2.0.0   Microsoft.AspNetCore.All (> = 2.0.0) -> Microsoft.AspNetCore.ApplicationInsights.HostingStartup (> = 2.0.0) -> Microsoft.ApplicationInsights.AspNetCore (> = 2.1. 1)   Application (> = 1.0.0) -> Microsoft.ApplicationInsights.AspNetCore (> = 2.0.0)

After that, I get this message for all the components:

The Microsoft.AspNetCore.ANYPACKAGE 2.0.0 package is not compatible with netcoreapp2.0 (.NETCoreApp, Version = v2.0). The Microsoft.AspNetCore.WebSockets 2.0.0 package supports: netstandard2.0 (.NETStandard, Version = v2.0)

This is the manual:

https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/

SDK Updated to 2.0:

enter image description here

This is my csproj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="wwwroot\lib\kendo-ui-core\**" />
    <Content Remove="wwwroot\lib\kendo-ui-core\**" />
    <EmbeddedResource Remove="wwwroot\lib\kendo-ui-core\**" />
    <None Remove="wwwroot\lib\kendo-ui-core\**" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="wwwroot\css\bootstrap-lumen.css" />
    <Content Include="wwwroot\css\bootstrap-sand.css" />
    <Content Include="wwwroot\css\bootstrap-sand.min.css" />
    <Content Include="wwwroot\js\application-role-index.js" />
    <Content Include="wwwroot\js\family-index.js" />
    <Content Include="wwwroot\js\jquery-3.2.1.min.js" />
    <Content Include="wwwroot\js\modal-action-store.js" />
    <Content Include="wwwroot\js\populate-district.js" />
    <Content Include="wwwroot\js\store-index.js" />
    <Content Include="wwwroot\js\type-index.js" />
    <Content Include="wwwroot\js\user-index.js" />
    <Content Include="wwwroot\js\jquery.filtertable.min.js" />
    <Content Include="wwwroot\js\machine-index.js" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Bootstrap.v3.Datetimepicker" Version="4.17.45" />
    <PackageReference Include="Bootstrap.v3.Datetimepicker.CSS" Version="4.17.45" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="2.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="NuGet.CommandLine" Version="4.1.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
  </ItemGroup>

</Project>

Thanks in advance for any help.

Edit: More info

After compiling the solution I got this message:

1> CSC: error CS1703: Multiple assemblies with equivalent identity have been imported: 'C: \ Users \ user \ .nuget \ packages \ microsoft.netcore.app \ 2.0.0 \ ref \ netcoreapp2.0 \ System.ComponentModel.dll 'And' C: \ Users \ User \ .nuget \ packages \ system.componentmodel \ 4.3.0 \ ref \ netstandard1.0 \ System.ComponentModel.dll '. Remove one of the duplicate references.

3
what happens when you create a brand new .net core 2 project and then add EF to it?TrevorBrooks

3 Answers

39
votes

Also, this error can occur with an outdated version of nuget. Specifically, 4.0.0 exhibits this issue. Upgrading to 4.3.0 fixed the problem for me.

VSTS agents seem to use 4.0.0, so to work around this, there is a nuget version installer task which you can run as part of your build step to upgrade the version of nuget running in your build pipeline.

21
votes

Solved it by updating Visual Studio to it's latest version (for me it was 15.3.3)

Also, make sure SDK is updated to version 2.0 and NuGet to its latest version.

0
votes

You should install the new version of SDK. There are many solutions for this issue in GitHub such as https://github.com/dotnet/core/issues/1675