The type [Type] exists in both [Assembly1] and [netstandard 2.0 assembly]

Viewed 15712

I cannot get Microsoft.EntityFrameworkCore 2.0 to work with NETStandard.Library 2.0

Error CS0433 The type 'AttributeUsageAttribute' exists in both 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Contrived.Model.Schema D:\Contrived\Contrived\Framework\Contrived.Model.Schema\Attributes\EntityColumnAttribute.cs

My .csproj:

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

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="NETStandard.Library" Version="2.0.0" />
  </ItemGroup>

</Project>

This also happens if i create a new solution and a netstandard 2.0 library then add entityframeworkcore 2.0

Error CS1703 Multiple assemblies with equivalent identity have been imported: 'D:\Users\maksymiuk_a.nuget\packages\netstandard.library\2.0.0\build\netstandard2.0\ref\System.Threading.Tasks.dll' and 'D:\Users\maksymiuk_a.nuget\packages\system.threading.tasks\4.3.0\ref\netstandard1.3\System.Threading.Tasks.dll'. Remove one of the duplicate references. ClassLibrary1 D:\Contrived\Contrived\ClassLibrary1\ClassLibrary1\CSC

5 Answers

In my case I have added multiple reference in web.config file. after removing one of them resolve the issue and working perfectly under local IIS server also

Related