Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building Netstandard 2.0 class library fails if dependency includes System.Net.HttpClient #1313

Closed
clairernovotny opened this issue Jun 7, 2017 · 8 comments

Comments

@clairernovotny
Copy link

clairernovotny commented Jun 7, 2017

With 15.3 preview 1, building a netstandard2.0 class lib that has a dependency on a package including system.net.httpclient 4.3.2, I get build errors:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0433	The type 'HttpClient' exists in both 'System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'	ClassLibrary8	C:\dev\ClassLibrary8\ClassLibrary8\obj\Debug\netstandard2.0\RefitStubs.g.cs	39	Active
Error	CS0433	The type 'HttpClient' exists in both 'System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'	ClassLibrary8	C:\dev\ClassLibrary8\ClassLibrary8\obj\Debug\netstandard2.0\RefitStubs.g.cs	40	Active
Error	CS0433	The type 'HttpClient' exists in both 'System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'	ClassLibrary8	C:\dev\ClassLibrary8\ClassLibrary8\obj\Debug\netstandard2.0\RefitStubs.g.cs	42	Active

ClassLibrary8.zip

You can also see the solution explorer doing something silly:
1

@clairernovotny clairernovotny changed the title HttpClient included twice with Netstandard 2.0 class library Building Netstandard 2.0 class library fails if dependency includes System.Net.HttpClient Jun 7, 2017
@livarcocc
Copy link
Contributor

@ericstj @dsplaisted Conflict resolution issue?

@ericstj
Copy link
Member

ericstj commented Jun 7, 2017

I believe this is a known issue: dotnet/standard#372.

@onovotny can you update to the latest NETStandard.Library package from dotnet-core feed and see if it repros?

Try adding

 <NETStandardImplicitPackageVersion>2.0.0-preview2-25401-01</NETStandardImplicitPackageVersion>

/cc @weshaggard

@clairernovotny
Copy link
Author

@ericstj will that work with my preview 1 tooling?

@ericstj
Copy link
Member

ericstj commented Jun 7, 2017

Yep, it should. Not offline of course, and be careful about having dotnet-core registered and using PackageManager UI, but give it a try to see if it fixes the issue.

@clairernovotny
Copy link
Author

clairernovotny commented Jun 7, 2017

Okay, that worked, closing this as a dup then. Thanks!

@weitzhandler
Copy link

@ericstj

I'm having the same issue, but in a NetStandard 1.4 assembly.
Adding the line you referenced above:

<NETStandardImplicitPackageVersion>2.0.0-preview2-25401-01</NETStandardImplicitPackageVersion>

into the csproj file didn't remove the error, but that's probably because I didn't know what to replace 2.0.0-preview2-25401-01 with.

@ericstj
Copy link
Member

ericstj commented Aug 1, 2017

@weitzhandler open a new issue with a full description of your issue, including the version of the SDK/VS that you are using. Netstandard.dll should never appear in a netstandard1.4 project so I need to see a more comprehensive description of the issue to understand what you're seeing.

@weitzhandler
Copy link

@ericstj #1463

mmitche pushed a commit to mmitche/sdk that referenced this issue Jun 5, 2020
…0200226.7 (dotnet#1313)

- Microsoft.AspNetCore.Analyzers - 5.0.0-preview.2.20126.7
- Microsoft.AspNetCore.Components.Analyzers - 5.0.0-preview.2.20126.7
- Microsoft.AspNetCore.Mvc.Analyzers - 5.0.0-preview.2.20126.7
- Microsoft.AspNetCore.Mvc.Api.Analyzers - 5.0.0-preview.2.20126.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants