Incorrect conditional references created for group dependencies #1505

Closed
kevinbosman opened this Issue Mar 9, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@kevinbosman
Contributor

kevinbosman commented Mar 9, 2016

Case in point:
NuGet package EasyNetQ v0.53.6.419 has the following nuspec dependency list:

    <dependencies>
      <group>
        <dependency id="RabbitMQ.Client" version="[3.5.7, ]" />
        <dependency id="Microsoft.Bcl" version="1.1.10" />
        <dependency id="Microsoft.Bcl.Async" version="1.0.168" />
        <dependency id="Microsoft.Bcl.Build" version="1.0.21" />
      </group>
      <group targetFramework=".NETFramework4.5">
        <dependency id="RabbitMQ.Client" version="[3.5.7, ]" />
      </group>
    </dependencies>

The desired behaviour is that framework >= net45 should NOT need the references to Microsoft.Bcl.*; everything else should.

Given my paket.dependencies contains:

nuget EasyNetQ ~> 0.53.6 framework: >= net45

Paket v2.51.7 incorrectly creates the following reference conditionals in the project file, which are exactly inverted:

  <Choose>
    <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')">
      <ItemGroup>
        <Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
          <HintPath>..\packages\Microsoft.Bcl.Async\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
        <Reference Include="Microsoft.Threading.Tasks.Extensions">
          <HintPath>..\packages\Microsoft.Bcl.Async\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
        <Reference Include="Microsoft.Threading.Tasks">
          <HintPath>..\packages\Microsoft.Bcl.Async\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
        <Reference Include="System.Net">
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>

paket.lock also incorrectly contains:

    EasyNetQ (0.53.6.419) - framework: >= net45
      Microsoft.Bcl (>= 1.1.10)
      Microsoft.Bcl.Async (>= 1.0.168)
      Microsoft.Bcl.Build (>= 1.0.21)
      RabbitMQ.Client (>= 3.5.7)
    Microsoft.Bcl (1.1.10) - framework: >= net45
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Async (1.0.168) - framework: >= net45
      Microsoft.Bcl (>= 1.1.8)
    Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: >= net45
    RabbitMQ.Client (3.6.1) - framework: >= net45

For completeness, the project file also correctly contains:

  <Choose>
    <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')">
      <ItemGroup>
        <Reference Include="EasyNetQ">
          <HintPath>..\packages\EasyNetQ\lib\net45\EasyNetQ.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>
   <Choose>
    <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')">
      <ItemGroup>
        <Reference Include="RabbitMQ.Client">
          <HintPath>..\packages\RabbitMQ.Client\lib\net45\RabbitMQ.Client.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>
@kevinbosman

This comment has been minimized.

Show comment
Hide comment
@kevinbosman

kevinbosman Mar 9, 2016

Contributor

This is pure speculation before looking at any code, but is it possible that targetFramework parsing is inconsistent with NuGet parsing?

Notice in the nuspec that targetFramework=".NETFramework4.5". This works perfectly in NuGet as per the framework parsing rules defined here: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Frameworks/NuGetFrameworkFactory.cs

Contributor

kevinbosman commented Mar 9, 2016

This is pure speculation before looking at any code, but is it possible that targetFramework parsing is inconsistent with NuGet parsing?

Notice in the nuspec that targetFramework=".NETFramework4.5". This works perfectly in NuGet as per the framework parsing rules defined here: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Frameworks/NuGetFrameworkFactory.cs

@forki forki added the bug label Mar 9, 2016

@forki forki closed this in bf31fd2 Mar 9, 2016

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Mar 9, 2016

Member

could you please retry? thx

Member

forki commented Mar 9, 2016

could you please retry? thx

@kevinbosman

This comment has been minimized.

Show comment
Hide comment
@kevinbosman

kevinbosman Mar 9, 2016

Contributor

No improvement after paket update on v2.51.9 :/

Contributor

kevinbosman commented Mar 9, 2016

No improvement after paket update on v2.51.9 :/

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Mar 9, 2016

Member

Are you sure? Did you try to run "paket update -f"?
On Mar 9, 2016 13:19, "Kevin Bosman" notifications@github.com wrote:

No improvement after paket update on v2.51.9 :/


Reply to this email directly or view it on GitHub
#1505 (comment).

Member

forki commented Mar 9, 2016

Are you sure? Did you try to run "paket update -f"?
On Mar 9, 2016 13:19, "Kevin Bosman" notifications@github.com wrote:

No improvement after paket update on v2.51.9 :/


Reply to this email directly or view it on GitHub
#1505 (comment).

@kevinbosman

This comment has been minimized.

Show comment
Hide comment
@kevinbosman

kevinbosman Mar 9, 2016

Contributor

Ah, ok it fixes it when I do update -f, but then puts bcl back when I then do a straight update thereafter

Contributor

kevinbosman commented Mar 9, 2016

Ah, ok it fixes it when I do update -f, but then puts bcl back when I then do a straight update thereafter

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Mar 9, 2016

Member

really?

just to make sure there is no cache issue.

Can you please run paket clear-cache and try the update again?

Member

forki commented Mar 9, 2016

really?

just to make sure there is no cache issue.

Can you please run paket clear-cache and try the update again?

@kevinbosman

This comment has been minimized.

Show comment
Hide comment
@kevinbosman

kevinbosman Mar 9, 2016

Contributor

Thank you. Yes, it must have been a cache issue... I have 2 sources defined & -f was consistently only refreshing one of them, straight update must have been using the other - which is odd in itself, but possibly coincidental.
I didn't actually run clear-cache, but after I listed each source individually in turn it came right.
Thanks for fixing this so quickly! :)

Contributor

kevinbosman commented Mar 9, 2016

Thank you. Yes, it must have been a cache issue... I have 2 sources defined & -f was consistently only refreshing one of them, straight update must have been using the other - which is odd in itself, but possibly coincidental.
I didn't actually run clear-cache, but after I listed each source individually in turn it came right.
Thanks for fixing this so quickly! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment