Skip to content

Lock file has incorrect .NET framework lock #462

Closed

Description

@isaacabraham

Create a paket.dependencies file as follows: -

source https://nuget.org/api/v2
nuget WindowsAzure.Storage

The lock file generated looks like this: -

NUGET
  remote: https://nuget.org/api/v2
  specs:
    Microsoft.Data.Edm (5.6.3)
    Microsoft.Data.OData (5.6.3)
      Microsoft.Data.Edm (5.6.3)
      System.Spatial (5.6.3)
    Microsoft.Data.Services.Client (5.6.3) - net40
      Microsoft.Data.OData (5.6.3)
    Microsoft.WindowsAzure.ConfigurationManager (2.0.3) - net40
    Newtonsoft.Json (6.0.6) - net40
    System.Spatial (5.6.3)
    WindowsAzure.Storage (4.3.0)
      Microsoft.Data.OData (>= 5.6.2)
      Microsoft.Data.OData (>= 5.6.2) - net40
      Microsoft.Data.OData (>= 5.6.2) - winv4.5
      Microsoft.Data.OData (>= 5.6.2) - wpv8.0
      Microsoft.Data.Services.Client (>= 5.6.2) - net40
      Microsoft.WindowsAzure.ConfigurationManager (>= 1.8.0.0) - net40
      Newtonsoft.Json (>= 5.0.8) - net40
      Newtonsoft.Json (>= 5.0.8) - wpv8.0

Notice the net40 restrictions on a number of dependencies. On a brand new FSharp Class Library (using net45), these are not available for consumption within code. For example, for Newtonsoft.Json, the only node in the .fsproj file is: -

  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.0'">
      <ItemGroup>
        <Reference Include="Newtonsoft.Json">
          <HintPath>..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>

If you remove the net40 from the lock file and then do a paket install --hard, everything works fine. You get multiple When elements in the project file, one for each version made available by the dependency.

Activity

  1. forki commented on Dec 21, 2014

    @forki
    Member

    Mhm the nuspec specifies the net40 restriction. See:

    <?xml version="1.0"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
      <metadata>
        <id>WindowsAzure.Storage</id>
        <version>4.3.0</version>
        <title>Windows Azure Storage</title>
        <authors>Microsoft</authors>
        <owners>Microsoft</owners>
        <licenseUrl>http://go.microsoft.com/fwlink/?LinkId=331471</licenseUrl>
        <projectUrl>http://go.microsoft.com/fwlink/?LinkId=235168</projectUrl>
        <iconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</iconUrl>
        <requireLicenseAcceptance>true</requireLicenseAcceptance>
        <description>This client library enables working with the Microsoft Azure storage services which include the blob and file service for storing binary and text data, the table service for storing structured non-relational data, and the queue service for storing messages that may be accessed by a client. 
    For this release see notes - https://github.com/Azure/azure-storage-net/blob/master/README.md and https://github.com/Azure/azure-storage-net/blob/master/changelog.txt
    Microsoft Azure Storage team's blog - http://blogs.msdn.com/b/windowsazurestorage/</description>
        <summary>A client library for working with Microsoft Azure storage services including blobs, files, tables, and queues.</summary>
        <tags>Microsoft, Azure, Storage, Table, Blob, File, Queue, Scalable, windowsazureofficial</tags>
        <dependencies>
          <group targetFramework=".NETFramework4.0-Client">
            <dependency id="Microsoft.Data.OData" version="5.6.2" />
            <dependency id="Newtonsoft.Json" version="5.0.8" />
            <dependency id="Microsoft.Data.Services.Client" version="5.6.2" />
            <dependency id="Microsoft.WindowsAzure.ConfigurationManager" version="1.8.0.0" />
          </group>
          <group targetFramework="Windows8.0">
            <dependency id="Microsoft.Data.OData" version="5.6.2" />
          </group>
          <group targetFramework="WindowsPhoneApp0.0">
            <dependency id="Microsoft.Data.OData" version="5.6.2" />
          </group>
          <group targetFramework="WindowsPhone8.0">
            <dependency id="Microsoft.Data.OData" version="5.6.2" />
            <dependency id="Newtonsoft.Json" version="5.0.8" />
          </group>
        </dependencies>
        <frameworkAssemblies>
          <frameworkAssembly assemblyName="System.Data" targetFramework=".NETFramework4.0-Client" />
          <frameworkAssembly assemblyName="System.Xml" targetFramework="" />
          <frameworkAssembly assemblyName="System.Xml.Linq" targetFramework="" />
        </frameworkAssemblies>
        <references>
          <reference file="Microsoft.WindowsAzure.Storage.dll" />
        </references>
      </metadata>
    </package>
    

    Nuget.exe will still install Json.Net.dll - strange.

  2. forki commented on Dec 21, 2014

    @forki
    Member

    Ok, after rereading #140 (comment) and remembering disucssion with @agross I now think we need to do the same framework inheritance strategy as in the file referencing algorithm.

  3. isaacabraham commented on Dec 21, 2014

    @isaacabraham
    ContributorAuthor

    Yeah that was my thought - net40 should fall back to any higher FWs as well unless specified elsewhere.

  4. isaacabraham commented on Dec 21, 2014

    @isaacabraham
    ContributorAuthor

    I think that this was the root cause of #448 as well.

  5. forki commented on Dec 21, 2014

    @forki
    Member

    It's actually much more complicated than I thought, but I'm starting to work on it...

  6. isaacabraham commented on Dec 21, 2014

    @isaacabraham
    ContributorAuthor

    :-( sorry!

  7. forki commented on Dec 21, 2014

    @forki
    Member
  8. forki commented on Dec 22, 2014

    @forki
    Member

    the new lockfile looks like that:

    NUGET
      remote: http://nuget.org/api/v2
      specs:
        Microsoft.Data.Edm (5.6.3)
        Microsoft.Data.OData (5.6.3) - >= net40, winv4.5, wpv8.0
          Microsoft.Data.Edm (5.6.3)
          System.Spatial (5.6.3)
        Microsoft.Data.Services.Client (5.6.3) - >= net40
          Microsoft.Data.OData (5.6.3)
        Microsoft.WindowsAzure.ConfigurationManager (2.0.3) - >= net40
        Newtonsoft.Json (6.0.6) - >= net40, wpv8.0
        System.Spatial (5.6.3)
        WindowsAzure.Storage (4.3.0)
          Microsoft.Data.OData (>= 5.6.2) - >= net40, winv4.5, wpv8.0
          Microsoft.Data.Services.Client (>= 5.6.2) - >= net40
          Microsoft.WindowsAzure.ConfigurationManager (>= 1.8.0.0) - >= net40
          Newtonsoft.Json (>= 5.0.8) - >= net40, wpv8.0
    
  9. forki commented on Dec 22, 2014

    @forki
    Member

    The Lockfile for MathNet.Numerics looks like that:

    NUGET
      remote: http://nuget.org/api/v2
      specs:
        MathNet.Numerics (3.3.0)
          TaskParallelLibrary (>= 1.0.2856) - >= net35 < net40
        TaskParallelLibrary (1.0.2856) - >= net35 < net40
    
  10. cdrnet commented on Dec 22, 2014

    @cdrnet
    Member

    Great, that looks exactly like what I intended in the MathNet.Numerics nuspec!

  11. forki commented on Dec 22, 2014

    @forki
    Member

    please test 0.20 alpha - it's a huge change

  12. isaacabraham commented on Dec 22, 2014

    @isaacabraham
    ContributorAuthor

    awesome :-) will check shortly :-)

  13. isaacabraham commented on Dec 23, 2014

    @isaacabraham
    ContributorAuthor

    Just tried using the latest v20 alpha (6) and it works fine. Great stuff.

  14. cdrnet commented on Dec 23, 2014

    @cdrnet
    Member

    I've just tried with v20 alpha 7 as well, with a package with even more complicated framework groups: MathNet.Numerics.FSharp-v3.3.0 (sorry! - ah, and yes, the next version will migrate to the new FSharp.Core NuGet package)

        <dependencies>
            <group>
                <dependency id="MathNet.Numerics" version="[3.3.0]" />
                <dependency id="FSharp.Core.Microsoft.Signed" version="3.1.1.1" />
            </group>
            <group targetFramework=".NETFramework3.5">
                <dependency id="MathNet.Numerics" version="[3.3.0]" />
            </group>
            <group targetFramework=".NETFramework4.0">
                <dependency id="MathNet.Numerics" version="[3.3.0]" />
                <dependency id="FSharp.Core.Microsoft.Signed" version="3.1.1.1" />
            </group>
        </dependencies>
    

    The intention of these groups is to have the MathNet.Numerics dependency in all cases, and the FSharp.Core dependency everywhere except .Net3.5 <= x < .Net 4.0. The group without a target framework acts as fallback where none of the groups is inherited by the current target.

    Now, with v20alpha7 the dependencies file

    source http://nuget.org/api/v2
    
    # Core Dependencies
    nuget FParsec ~> 1.0.1
    nuget FSharp.Core.Microsoft.Signed ~> 3.1.1
    nuget MathNet.Numerics.FSharp ~> 3.3.0
    
    # Development Dependencies
    nuget FsUnit ~> 1.3
    
    # Tools
    nuget FAKE ~> 3.5
    nuget NUnit.Runners ~> 2.6
    nuget FSharp.Formatting !~> 2.4
    nuget NuGet.CommandLine
    

    leads to the lock file

    NUGET
      remote: http://nuget.org/api/v2
      specs:
        FAKE (3.12.2)
        FParsec (1.0.1)
        FSharp.Compiler.Service (0.0.67)
        FSharp.Core.Microsoft.Signed (3.1.1.1)
        FSharp.Formatting (2.4.36)
          FSharp.Compiler.Service (0.0.67)
          Microsoft.AspNet.Razor (2.0.30506.0)
          RazorEngine (3.3.0)
        FsUnit (1.3.0.1)
          NUnit (>= 2.6.3)
        MathNet.Numerics (3.3.0) - >= net35, >= net40
          TaskParallelLibrary (>= 1.0.2856) - >= net35 < net40
        MathNet.Numerics.FSharp (3.3.0)
          FSharp.Core.Microsoft.Signed (>= 3.1.1.1) - >= net40
          MathNet.Numerics (3.3.0) - >= net35, >= net40
        Microsoft.AspNet.Razor (2.0.30506.0)
        NuGet.CommandLine (2.8.3)
        NUnit (2.6.4)
        NUnit.Runners (2.6.4)
        RazorEngine (3.3.0)
          Microsoft.AspNet.Razor (>= 2.0.30506.0)
        TaskParallelLibrary (1.0.2856) - >= net35 < net40
    

    The lock on TaskParallelLibrary is now perfect, but to my understanding the MathNet.Numerics dependency should not have any framework constraints, or at least the >=net40 one dropped?

  15. cdrnet commented on Dec 23, 2014

    @cdrnet
    Member

    Hm, maybe I better simplify these constraints instead, they are way too complicated ...

  16. forki commented on Dec 23, 2014

    @forki
    Member

    Yes I thought about that case. Thanks for giving a test case. Will try to solve that.

  17. forki commented on Dec 27, 2014

    @forki
    Member
    source http://nuget.org/api/v2
    
    nuget MathNet.Numerics.FSharp ~> 3.3.0
    

    now gives:

    NUGET
      remote: http://nuget.org/api/v2
      specs:
        FSharp.Core.Microsoft.Signed (3.1.1.1)
        MathNet.Numerics (3.3.0)
          TaskParallelLibrary (>= 1.0.2856) - >= net35 < net40
        MathNet.Numerics.FSharp (3.3.0)
          FSharp.Core.Microsoft.Signed (>= 3.1.1.1)
          MathNet.Numerics (3.3.0)
        TaskParallelLibrary (1.0.2856) - >= net35 < net40
    
  18. forki commented on Dec 27, 2014

    @forki
    Member

    seems there is still an issue with FSharp.Core.Microsoft.Signed!?

  19. isaacabraham commented on Dec 27, 2014

    @isaacabraham
    ContributorAuthor

    Also seen that Humanizer isn't working getting referenced on the latest alpha. Looking at the package, it has a single folder in the lib folder: portable-win%2Bnet40%2Bsl50%2Bwp8%2Bwpa81. Yet on a .NET 4.5.1 project, despite there being an entry in the lock and references files, there's no entry in the .fsproj (not even one with a bad When condition).
    In fact I can't even reference this dll directly - it looks like the + in the lib folder have been URL encoded. If I manually rename the lib folder to have + instead of %2B, it all works.

  20. forki commented on Dec 27, 2014

    @forki
    Member

    Isaac, can you please create a repro sample and open a new issue. I tried to reproduce, but Humanizer works fine for me.

  21. isaacabraham commented on Dec 27, 2014

    @isaacabraham
    ContributorAuthor

    Sure. Let me remove the package completely and redownload it first.

  22. isaacabraham commented on Dec 27, 2014

    @isaacabraham
    ContributorAuthor

    Bizarre. Just redownloaded it and it came down fine without %2B. Sorry.

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