I am trying to create a NuGet package that is dependent on System.Net.Http (I need HttpClient). For Framework version 4.5.1, this assembly is part of BCL. However, in 4.0 this is not the case. I believe that he correctly compiled the correct conditional statements in csproj.
The problem that I am currently facing is that when I refer to this package in project 4.5.1, it pulls a dependency on Microsoft.Net.Http . I really only want to depend on Microsoft.Net.Http for net40.
Here is my nuspec file:
<?xml version="1.0"?> <package> <metadata> <id>MyApp</id> <version>$version$</version> <title>MyApp</title> <authors>Me</authors> <owners>Me</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Description</description> <releaseNotes>Initial release</releaseNotes> <copyright>Copyright 2016</copyright> <dependencies> <group> <dependency id="Newtonsoft.Json" version="8.0.2"/> </group> <group targetFramework="net40"> <dependency id="Microsoft.Bcl" version="1.1.10" /> <dependency id="Microsoft.Bcl.Build" version="1.0.14" /> <dependency id="Microsoft.Net.Http" version="2.2.29" /> </group> </dependencies> </metadata> <files> <file src="bin\release\**\MyApp.dll" target="lib" /> </files> </package>
In VS, the NuGet package shows this:

But then again, I am also dependent when you use a project with a target structure of 4.5.1. Which I do not want. Any help is appreciated.
source share