Skip to content

0.20.1 inserts wrong framework version condition into project files #486

Closed

Description

@vasily-kirichenko

I updated Paket to version 0.20.1 (was 0.18), then run paket update.

paket.lock (part of)

Fizzler (1.0.0)
  LinqBridge (>= 1.3.0) - >= net20 < net35
Fizzler.Systems.HtmlAgilityPack (1.0.0)
  Fizzler (>= 1.0.0) - >= net20, >= net35
  HtmlAgilityPack (>= 1.4.6) - >= net20, >= net35
  LinqBridge (>= 1.3.0) - >= net20 < net35

its changes:

image

A .NET 4.5 C# project with the following paket.references

AutoFixture
Castle.Core
Fizzler
Moq
NUnit
HtmlAgilityPack
Fizzler
Fizzler.Systems.HtmlAgilityPack

has been amended as following

<Choose>
-    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v2.0'">
+    <When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5' Or $(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
       <ItemGroup>
         <Reference Include="LinqBridge">
           <HintPath>..\..\packages\LinqBridge\lib\net20\LinqBridge.dll</HintPath>
           <Private>True</Private>
           <Paket>True</Paket>
         </Reference>
       </ItemGroup>
     </When>
</Choose>

As a result LinqBridge is actually referenced and conflicting with System.Linq:

error CS0433: The type 'System.Linq.Enumerable' exists in both '...\packages\LinqBridge\lib\net20\LinqBridge.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll'

Activity

  1. forki commented on Dec 30, 2014

    @forki
    Member

    So LinqBridge is tagged as:

    LinqBridge (1.3.0) - >= net20 < net35

    but it's still installed for .NET 4.x?

  2. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    Yes, all the packages are on nuget.org.

    So LinqBridge is tagged as:
    LinqBridge (1.3.0) - >= net20 < net35
    but it's still installed for .NET 4.x?

    Yes, this is the problem.

  3. forki commented on Dec 30, 2014

    @forki
    Member

    I tried with:

    source https://nuget.org/api/v2
    
    nuget HtmlAgilityPack = 1.4.6
    nuget Fizzler.Systems.HtmlAgilityPack
    

    and it gives me:

    <Choose>
      <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0')">
        <ItemGroup>
          <Reference Include="LinqBridge">
            <HintPath>..\..\packages\LinqBridge\lib\net20\LinqBridge.dll</HintPath>
            <Private>True</Private>
            <Paket>True</Paket>
          </Reference>
        </ItemGroup>
      </When>
    </Choose>
    

    Maybe something else is making trouble.

  4. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    Add Fizzler package into the mix.

  5. forki commented on Dec 30, 2014

    @forki
    Member

    Will try. But probably tomorrow.
    On Dec 30, 2014 3:12 PM, "Vasily Kirichenko" [email protected]
    wrote:

    Add Fizzler package into the mix.

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

  6. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor
  7. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    I minimized it even more :)

  8. forki commented on Dec 30, 2014

    @forki
    Member

    I just run paket update:

    image

    image

    that's weird. Everything looks good.

  9. forki commented on Dec 30, 2014

    @forki
    Member

    ok paket install gives a different result. I can reproduce.

  10. forki commented on Dec 30, 2014

    @forki
    Member

    I think I understand the issue - will try to fix tomorrow. Thanks for reporting.

  11. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    Yes, I've got the same result at home machine :( Will retest on the machine at work in a minute.

  12. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    I've caught it :) Pull the changes from my repo - I removed everything from paket.references, so the project file is clean. Now add

    HtmlAgilityPack
    Fizzler.Systems.HtmlAgilityPack
    

    into it, then run paket install and the bug will appear (LinqBridge.dll will be referenced).

  13. vasily-kirichenko commented on Dec 30, 2014

    @vasily-kirichenko
    ContributorAuthor

    Thanks!

  14. forki commented on Dec 30, 2014

    @forki
    Member

    Yep. It's a bug in "install" - "paket update" seems ok.

    "install" has to parse/keep the dependency restrictions.
    "update" is not affected since it computes everything from scratch.

  15. forki commented on Dec 31, 2014

    @forki
    Member

    Please retry.

  16. vasily-kirichenko commented on Dec 31, 2014

    @vasily-kirichenko
    ContributorAuthor

    0.20.3, paket install

     <Choose>
        <When Condition="($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v2.0' Or $(TargetFrameworkVersion) == 'v3.0' Or $(TargetFrameworkVersion) == 'v3.5' Or $(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch')">
          <ItemGroup>
            <Reference Include="LinqBridge">
              <HintPath>packages\LinqBridge\lib\net20\LinqBridge.dll</HintPath>
              <Private>True</Private>
              <Paket>True</Paket>
            </Reference>
          </ItemGroup>
        </When>
      </Choose>
     </Project>
  17. forki commented on Dec 31, 2014

    @forki
    Member

    (did you run update before? the new install assumes the lockfile is in "correct" state and shouldn't break it. But it doesn't fix broken lockfiles)

    will try to run with your latest repro. Did my test on the thingy from yesterday.

  18. forki commented on Dec 31, 2014

    @forki
    Member

    Ok I tried with your latest repro:

    Please run paket update once. This will fix the broken lockfile (broken due to bug in earlier paket install)

    Subsequent runs of paket install will respect the targetframework restrictions.

  19. vasily-kirichenko commented on Dec 31, 2014

    @vasily-kirichenko
    ContributorAuthor
    1. delete paket.lock
    2. remove everything from paket.references
    3. run paket install
    4. All refs are removed from project file
    5. Revert paket.references back
    6. run paket install
    7. the project file is correctly modified
  20. vasily-kirichenko commented on Dec 31, 2014

    @vasily-kirichenko
    ContributorAuthor

    I think it should check if project file contains correct when Conditions and modifies them if needed.

  21. forki commented on Dec 31, 2014

    @forki
    Member

    ^^ that's basically what paket update does.

  22. vasily-kirichenko commented on Dec 31, 2014

    @vasily-kirichenko
    ContributorAuthor

    OK :) Thanks.

  23. forki commented on Dec 31, 2014

    @forki
    Member

    I think it should check if project file contains correct when Conditions and modifies them if needed.

    that's what we do. The issue was, that the lockfile didn't containt the framework restrictions.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions