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

Incorrect conditional references created for group dependencies #1505

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

Incorrect conditional references created for group dependencies #1505

kevinbosman opened this issue Mar 9, 2016 · 7 comments
Labels

Comments

@kevinbosman
Copy link
Contributor

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
Copy link
Contributor Author

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 as completed in bf31fd2 Mar 9, 2016
@forki
Copy link
Member

forki commented Mar 9, 2016

could you please retry? thx

@kevinbosman
Copy link
Contributor Author

No improvement after paket update on v2.51.9 :/

@forki
Copy link
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" [email protected] wrote:

No improvement after paket update on v2.51.9 :/


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

@kevinbosman
Copy link
Contributor Author

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

@forki
Copy link
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
Copy link
Contributor Author

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants