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

0.20.1 inserts wrong framework version condition into project files #486

Closed
vasily-kirichenko opened this issue Dec 30, 2014 · 23 comments
Closed
Labels

Comments

@vasily-kirichenko
Copy link
Contributor

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'
@forki
Copy link
Member

forki commented Dec 30, 2014

So LinqBridge is tagged as:

LinqBridge (1.3.0) - >= net20 < net35

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

@forki forki added the bug label Dec 30, 2014
@vasily-kirichenko
Copy link
Contributor Author

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.

@forki
Copy link
Member

forki commented Dec 30, 2014

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.

@vasily-kirichenko
Copy link
Contributor Author

Add Fizzler package into the mix.

@forki
Copy link
Member

forki commented Dec 30, 2014

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).

@vasily-kirichenko
Copy link
Contributor Author

Thanks!

I've create a minimal repro: https://github.com/vasily-kirichenko/PacketTest

@vasily-kirichenko
Copy link
Contributor Author

I minimized it even more :)

@forki
Copy link
Member

forki commented Dec 30, 2014

I just run paket update:

image

image

that's weird. Everything looks good.

@forki
Copy link
Member

forki commented Dec 30, 2014

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

@forki
Copy link
Member

forki commented Dec 30, 2014

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

@vasily-kirichenko
Copy link
Contributor Author

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

@vasily-kirichenko
Copy link
Contributor Author

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).

@vasily-kirichenko
Copy link
Contributor Author

Thanks!

@forki
Copy link
Member

forki commented Dec 30, 2014

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.

@forki forki closed this as completed in 7430827 Dec 31, 2014
@forki
Copy link
Member

forki commented Dec 31, 2014

Please retry.

@vasily-kirichenko
Copy link
Contributor Author

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>

@forki
Copy link
Member

forki commented Dec 31, 2014

(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.

@forki
Copy link
Member

forki commented Dec 31, 2014

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.

@vasily-kirichenko
Copy link
Contributor Author

  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

@vasily-kirichenko
Copy link
Contributor Author

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

@forki
Copy link
Member

forki commented Dec 31, 2014

^^ that's basically what paket update does.

@vasily-kirichenko
Copy link
Contributor Author

OK :) Thanks.

@forki
Copy link
Member

forki commented Dec 31, 2014

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

No branches or pull requests

2 participants