Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

"the type xx exists in both" after migration to csproj (Visual Studio 2017 RC)

$
0
0

Hello everybody, I start migrating my "old" .net core web app from vs.net 105 to vs.net 2017 rc...and the problems begin! In "old" xproj version my class libraries were built again net451, net46 and net461 frameworks : here is the project.json file:

{  "version": "1.0.2.0",  "description": "XXX",  "authors": [ "Administrator" ],  "packOptions": {    "tags": [],    "licenseUrl": ""  },
  "frameworks": {    "net451": {      "frameworkAssemblies": {        "System.Runtime": "4.0.10.0"      }    },    "net46": {      "frameworkAssemblies": {        "System.Runtime": "4.0.20.0"      }    },    "net461": {      "frameworkAssemblies": {        "System.Runtime": "4.0.20.0"      }    }  },  "dependencies": {    "Microsoft.ApplicationInsights": "2.3.0-beta1",    "Microsoft.Rest.ClientRuntime": "2.3.4"  },  "buildOptions": {    "compile": {      "include": [        "../../../Tracing/*.cs"      ]    }  }}

After migration i get a lot of build errors all like this:

SeverityCodeDescriptionProjectFileLineSuppression StateErrorCS0433The type 'HttpClientHandler' exists in both 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'WebApiServiceClient(net46), WebApiServiceClient(net461)

If I build against a single framework (change TargetFrameworks to TargetFramework  and use for example net451) it works.

Here is the csproj after migration:

<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">  <PropertyGroup>    <Description>XXX</Description>    <VersionPrefix>1.0.2.0</VersionPrefix>    <Authors>Administrator</Authors>    <TargetFrameworks>net451;net46;net461</TargetFrameworks>    <RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64</RuntimeIdentifiers>    <AssemblyName>XXX</AssemblyName>    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>  </PropertyGroup>  <ItemGroup>    <Compile Include="**\*.cs" Exclude="bin\**;obj\**;**\*.xproj;packages\**" />    <EmbeddedResource Include="**\*.resx" />    <EmbeddedResource Include="compiler\resources\**\*" />  </ItemGroup>  <ItemGroup>    <Compile Include="..\..\..\Tracing\ApplicationInsightsTracingInterceptor.cs">      <Link>ApplicationInsightsTracingInterceptor.cs</Link>    </Compile>  </ItemGroup>  <ItemGroup>    <PackageReference Include="NETStandard.Library">      <Version>1.6.0</Version>    </PackageReference>    <PackageReference Include="Microsoft.ApplicationInsights">      <Version>2.3.0-beta1</Version>    </PackageReference>    <PackageReference Include="Microsoft.Rest.ClientRuntime">      <Version>2.3.4</Version>    </PackageReference>  </ItemGroup>  <ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">    <Reference Include="System.Runtime" />    <Reference Include="System" />    <Reference Include="Microsoft.CSharp" />  </ItemGroup>  <ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">    <Reference Include="System.Runtime" />    <Reference Include="System" />    <Reference Include="Microsoft.CSharp" />  </ItemGroup>  <ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">    <Reference Include="System.Runtime" />    <Reference Include="System" />    <Reference Include="Microsoft.CSharp" />  </ItemGroup>  <PropertyGroup Label="Globals">    <SccProjectName>SAK</SccProjectName>    <SccProvider>SAK</SccProvider>    <SccAuxPath>SAK</SccAuxPath>    <SccLocalPath>SAK</SccLocalPath>  </PropertyGroup>  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">    <DefineConstants>$(DefineConstants);RELEASE</DefineConstants>  </PropertyGroup></Project>

VS.NET 2017 RC is 15.0.26020.0

Any help?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>