Repository navigation
Incorrect conditional references created for group dependencies #1505
Copy link
Copy link
Closed
Labels
Description
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>
Reactions are currently unavailable
Activity
kevinbosman commentedon 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.csforki commentedon Mar 9, 2016
could you please retry? thx
kevinbosman commentedon Mar 9, 2016
No improvement after
paket updateon v2.51.9 :/forki commentedon 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:
kevinbosman commentedon 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 commentedon 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 commentedon 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! :)