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

Dependency resolution for .NETFramework4.5 and .NETPortable0.0-wp8 netcore45 net45 wp81 wpa81 #1753

Closed
pedrofelixsky opened this issue Jun 24, 2016 · 9 comments
Labels

Comments

@pedrofelixsky
Copy link

pedrofelixsky commented Jun 24, 2016

In my project I'm using Microsoft.AspNet.WebApi.Client, which includes the following in the nuspec file

    <dependencies>
      <group targetFramework=".NETFramework4.5">
        <dependency id="Newtonsoft.Json" version="6.0.4" />
      </group>
      <group targetFramework=".NETPortable0.0-wp8 netcore45 net45 wp81 wpa81">
        <dependency id="Newtonsoft.Json" version="6.0.4" />
        <dependency id="Microsoft.Net.Http" version="2.2.22" />
      </group>
    </dependencies>

However, Paket seems to be using the second group (.NETPortable0.0-wp8 netcore45 net45 wp81 wpa81) even for .NETFramework4.5. This is visible in two places

  • The paket.lock file contains
Microsoft.AspNet.WebApi.Client (5.2.3) - framework: >= net45
    Microsoft.Net.Http (>= 2.2.22) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
  • The .csproj started including the Microsoft.Net.Http assemblies
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And   ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2')">
      <ItemGroup>
        <Reference Include="System.Net.Http.Extensions">
          <HintPath>..\..\..\packages\Microsoft.Net.Http\lib\net45\System.Net.Http.Extensions.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
        <Reference Include="System.Net.Http.Primitives">
          <HintPath>..\..\..\packages\Microsoft.Net.Http\lib\net45\System.Net.Http.Primitives.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
        <Reference Include="System.Net.Http.WebRequest">
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
  </When>  

If I add framework: >= net45 to the paket.dependencies file the behavior is the same.

This also appears to have been a change from past behavior, however if I revert back to version 2.66.0 the behavior is the same.
Can you provide me some information to help understand this behavior.
Thanks.

@forki
Copy link
Member

forki commented Jun 24, 2016

this sounds like a bug. I need to investigate

@forki
Copy link
Member

forki commented Jun 24, 2016

ok lock file looks correct to me:

NUGET
  remote: https://www.nuget.org/api/v2
    Microsoft.AspNet.WebApi.Client (5.2.3)
      Microsoft.Net.Http (>= 2.2.22) - framework: portable-wp80 win net45 wp81 wpa81
      Newtonsoft.Json (>= 6.0.4) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
    Microsoft.Bcl (1.1.10) - framework: portable-wp80 win net45 wp81 wpa81
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: portable-wp80 win net45 wp81 wpa81
    Microsoft.Net.Http (2.2.29) - framework: portable-wp80 win net45 wp81 wpa81
      Microsoft.Bcl (>= 1.1.10)
      Microsoft.Bcl.Build (>= 1.0.14)
    Newtonsoft.Json (8.0.3) - framework: >= net45, portable-wp80 win net45 wp81 wpa81

@forki
Copy link
Member

forki commented Jun 24, 2016

OK I think I know what's going on.

@forki forki added the bug label Jun 24, 2016
@pedrofelixsky
Copy link
Author

I was able to replicate the issue on a stand-alone console app.

paket.dependencies

source https://www.nuget.org/api/v2/

content: once
redirects: on

nuget Microsoft.AspNet.WebApi.Client 5.2.3 framework: >= net45

paket.references

Microsoft.AspNet.WebApi.Client

generated paket.lock

REDIRECTS: ON
CONTENT: ONCE
NUGET
  remote: https://www.nuget.org/api/v2
    Microsoft.AspNet.WebApi.Client (5.2.3) - framework: >= net45
      Microsoft.Net.Http (>= 2.2.22) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
      Newtonsoft.Json (>= 6.0.4) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
    Microsoft.Bcl (1.1.10) - framework: >= net45
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: >= net45
    Microsoft.Net.Http (2.2.29) - framework: >= net45
      Microsoft.Bcl (>= 1.1.10)
      Microsoft.Bcl.Build (>= 1.0.14)
    Newtonsoft.Json (8.0.3) - framework: >= net45

I used paket version 3.1.9

@forki forki closed this as completed in a739d0c Jun 24, 2016
@forki
Copy link
Member

forki commented Jun 24, 2016

I fixed this in latest alpha. lock file should now look like this:

Microsoft.AspNet.WebApi.Client (5.2.3)
  Microsoft.Net.Http (>= 2.2.22) - framework: portable-wp80 win wp81 wpa81
  Newtonsoft.Json (>= 6.0.4) - framework: >= net45, portable-wp80 win wp81 wpa81

And csproj should be fixed accordingly.

please give it a try and let me know.

@pedrofelixsky
Copy link
Author

I've deleted the paket.lock and performed paket install with 3.2.0-alpha006, however the paket.lock file still appears to have the same problem.

REDIRECTS: ON
CONTENT: ONCE
NUGET
  remote: https://www.nuget.org/api/v2
    Microsoft.AspNet.WebApi.Client (5.2.3) - framework: >= net45
      Microsoft.Net.Http (>= 2.2.22) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
      Newtonsoft.Json (>= 6.0.4) - framework: >= net45, portable-wp80 win net45 wp81 wpa81
    Microsoft.Bcl (1.1.10) - framework: >= net45
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: >= net45
    Microsoft.Net.Http (2.2.29) - framework: >= net45
      Microsoft.Bcl (>= 1.1.10)
      Microsoft.Bcl.Build (>= 1.0.14)
    Newtonsoft.Json (8.0.3) - framework: >= net45

@forki
Copy link
Member

forki commented Jun 24, 2016

can you please try "paket update -f" parts of this are in caching...

@pedrofelixsky
Copy link
Author

With paket install -f I now get

REDIRECTS: ON
CONTENT: ONCE
NUGET
  remote: https://www.nuget.org/api/v2
    Microsoft.AspNet.WebApi.Client (5.2.3) - framework: >= net45
      Newtonsoft.Json (>= 6.0.4) - framework: >= net45, portable-wp80 win wp81 wpa81
    Newtonsoft.Json (8.0.3) - framework: >= net45

(shouldn't there be a Microsoft.Net.Http (>= 2.2.22) - framework: portable-wp80 win wp81 wpa81?)
The csproj also looks good.

What is being cached? I was assuming that only the nuget packages were cached, not the resolution process.

Thanks.

@forki
Copy link
Member

forki commented Jun 24, 2016

  • Microsoft.Net.Http is completely filtered since it's not for net451
  • The Odata was cached so it doesn't reavaluate the deps restrictions of known package versions

I think everything looks good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants