Skip to content

Base NuGet Lib Reference generation on Lib Folders #145

Closed

Description

@bartelink

This is a split of an original issue #68 which, after some analysis breaks out into more than one problem.

I'm using latest of Microsoft.AspNet.WebApi which (indirectly) pulls in Microsoft.Net.Http. NPE shows it's lib has:

image

The lib subdirs I've expanded do not have a a System.Net.Http.dll (all the others I've collapsed have) but the default paket install behavior uniformly adds:

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

This clashes with the framework reference I need to add (which #145 should really be adding) yielding:

C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

The description alludes to this by saying

This package is not supported in Visual Studio 2010, and is only required for projects targeting .NET Framework 4.5, Windows 8, or Windows Phone 8.1 when consuming a library that uses this package.

The current workaround is to be very careful when switching platform from 4.0 <-> 4.5/4.5.1 to

  • add the FW assembly reference (<Reference Include="System.Net.Http" />) and delete the Paketprovided reference when going to 4.5
  • remove the <Reference Include="System.Net.Http" /> AND remember to re-paket install when going to 4.0

The only solution I can see is that Paket needs to start picking the TargetFramework it's going to apply in a context and then using that to manage the complete set of files rather than treating each file individually.

Activity

  1. bartelink commented on Sep 23, 2014

    @bartelink
    MemberAuthor

    Yet wackier again is NPEing Microsoft.Bcl:

    image

    (The various other variants with children have the same set of assemblies as net40)

    Right now, Paket erroneously adds files/dirs when I target FW 4.5.1, which I need to delete to avoid warnings.

    I'd love to know what the content folder is about - there is clearly no content in there for any target framework !

  2. added this to the NewInstaller milestone on Oct 7, 2014
  3. added a commit that references this issue on Jun 3, 2015
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions