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

paket isnt aware of current target framework #2233

Closed
enricosada opened this issue Apr 11, 2017 · 4 comments
Closed

paket isnt aware of current target framework #2233

enricosada opened this issue Apr 11, 2017 · 4 comments

Comments

@enricosada
Copy link
Collaborator

enricosada commented Apr 11, 2017

Description

Affect new sdk (the .net core sdk)

Paket doesnt seems to be aware of current target framework when restoring deps.

Repro steps

Create a .csproj who target net45 but does reference System.Collections.Specialized just for netstandard1.3, like

  1. Create myapp.csproj

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>net45</TargetFramework>
      </PropertyGroup>
       <Import Project="..\.paket\Paket.Restore.targets" /> 
    </Project>
  2. paket.dependencies

    source https://nuget.org/api/v2
    
    nuget System.Collections.Specialized  framework: netstandard13
    
  3. paket references

    System.Collections.Specialized framework: netstandard13
    
  4. dotnet restore

Expected behavior

Restore succeed, and System.Collections.Specialized is not a dependency

Actual behavior

Restore fails because System.Collections.Specialized doesnt support net45

Known workarounds

None.

Notes

As a note the following works.

    <ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
      <PackageReference Include="System.Collections.Specialized" Version="4.0.1" />
    </ItemGroup>

Minimizing the repro, i think is because paket.exe" restore --project "myapp.csproj" doesnt pass the $(TargetFramework) and the generated obj\myapp.csproj.references contains all the netstandard1.3 packages.

I think the paket target file should pass a --framework net45 argument invoking paket, so the generated obj\myapp.csproj.references contains only dependencies for that target framework.

Atm the target file cannot filter packages (adding the Condition="'$(TargetFramework)' == 'netstandard1.3'" because the information is missing, and ihmo is better done paket side)

As additional note, doing a crossgen (multiple target frameworks) currently invoke paket three times, so with the proposed change should work, because each time paket will generate correct package list and that will be included for that framework build.

ref elastic/elasticsearch-net#2711

@forki
Copy link
Member

forki commented Apr 11, 2017

I think I'd need help here

@enricosada
Copy link
Collaborator Author

@forki i think the current integration is ok.

just paket restore --project must expect also a target framework argument (--framework?), and filter packages before writing the list in the obj\myapp.csproj.references csv file.
At maybe we need to add the same conditionals, in the target file, after reading the file and creating the PackageReference items (i'll check if that is needed asap)

Is also possibile to generate a file for each target framework (like obj\myapp.csproj.net45.references) but that require paket to read the proj file to known target frameworks, so is a bit annoying, so 👎 ihmo.
Also atm paket will be called multiple times when multiple target framework (<TargetFrameworks>net45;netcoreapp1.0</TargetFrameworks>), so is not needed.

@matthid
Copy link
Member

matthid commented Apr 11, 2017

Is also possibile to generate a file for each target framework (like obj\myapp.csproj.net45.references) but that require paket to read the proj file to known target frameworks, so is a bit annoying, so 👎 ihmo.

Could we generate all? At least that would fit better into pakets philosophy (IMHO)

@forki
Copy link
Member

forki commented May 13, 2017

fixed with paket 5 beta 1

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

No branches or pull requests

3 participants