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

[4.8.6] Too many props are imported #2387

Closed
0x53A opened this issue Jun 2, 2017 · 6 comments
Closed

[4.8.6] Too many props are imported #2387

0x53A opened this issue Jun 2, 2017 · 6 comments

Comments

@0x53A
Copy link
Contributor

0x53A commented Jun 2, 2017

Afaik only props with the exact name packageName.props should be imported. All others should be ignored. Same for targets

source https://www.nuget.org/api/v2
source "C:\Users\lr\Documents\visual studio 2017\Projects\ConsoleApp3\ns16lib\bin\Debug"

nuget ns16lib
nuget NETStandard.Library prerelease
nuget NETStandard.Library.NETFramework prerelease

The csproj contains the following block:

  <Choose>
    <When Condition="1 == 1">
      <PropertyGroup>
        <__paket__NETStandard_Library_NETFramework_common_props>NETStandard.Library.NETFramework.common</__paket__NETStandard_Library_NETFramework_common_props>
      </PropertyGroup>
    </When>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.6.1'">
      <PropertyGroup>
        <__paket__NETStandard_Library_NETFramework_props>net461\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_props>
        <__paket__NETStandard_Library_NETFramework_targets>net461\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_targets>
      </PropertyGroup>
    </When>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
      <PropertyGroup>
        <__paket__NETStandard_Library_NETFramework_props>net462\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_props>
        <__paket__NETStandard_Library_NETFramework_targets>net462\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_targets>
      </PropertyGroup>
    </When>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.7'">
      <PropertyGroup>
        <__paket__NETStandard_Library_NETFramework_props>net47\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_props>
        <__paket__NETStandard_Library_NETFramework_targets>net47\NETStandard.Library.NETFramework</__paket__NETStandard_Library_NETFramework_targets>
      </PropertyGroup>
    </When>
  </Choose>
  <Import Project="..\packages\NETStandard.Library.NETFramework\build\$(__paket__NETStandard_Library_NETFramework_props).props" Condition="Exists('..\packages\NETStandard.Library.NETFramework\build\$(__paket__NETStandard_Library_NETFramework_props).props')" Label="Paket" />
  <Import Project="..\packages\NETStandard.Library.NETFramework\build\$(__paket__NETStandard_Library_NETFramework_common_props).props" Condition="Exists('..\packages\NETStandard.Library.NETFramework\build\$(__paket__NETStandard_Library_NETFramework_common_props).props')" Label="Paket" />
  <Choose>
    <When Condition="1 == 1">
      <PropertyGroup>
        <__paket__NETStandard_Library_targets>NETStandard.Library</__paket__NETStandard_Library_targets>
      </PropertyGroup>
    </When>
    <When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v2.0') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v2.0') Or ($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.7'))">
      <PropertyGroup>
        <__paket__NETStandard_Library_targets>netstandard2.0\NETStandard.Library</__paket__NETStandard_Library_targets>
      </PropertyGroup>
    </When>
  </Choose>
  <Choose>
    <When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v2.0') Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v2.0') Or ($(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac')">
      <PropertyGroup>
        <__paket__Microsoft_Packaging_Tools_Trimming_targets>Microsoft.Packaging.Tools.Trimming</__paket__Microsoft_Packaging_Tools_Trimming_targets>
        <__paket__Microsoft_Packaging_Tools_targets>Microsoft.Packaging.Tools</__paket__Microsoft_Packaging_Tools_targets>
      </PropertyGroup>
    </When>
  </Choose>

There are two issues:

  1. all *.props / *.targets are imported.
  2. multiple different defines are in the same Choose block, so only the first that evaluates to true is defined, the others are undefined and never imported. I think that is the root-cause of my issues in [5.0.0-beta008] referencing a netstandard1.6 lib from net461 does not work #2381, because the relevant props/targets are not imported.
@0x53A
Copy link
Contributor Author

0x53A commented Jun 2, 2017

fixed by fixed by #2388

@matthid
Copy link
Member

matthid commented Jun 2, 2017

So should we re-enable the net4.6.1 -> netstandard16 compat once we figured this one out?

@0x53A
Copy link
Contributor Author

0x53A commented Jun 2, 2017

Yeah, i guess

@0x53A
Copy link
Contributor Author

0x53A commented Jun 2, 2017

One I thing I just thought of:

Referencing a ns16 lib from full-fx requires that the user also adds a reference to that NETStandard.Library.NETFramework.

If he doesn't, it will fail at runtime.
If she does, it will add a shit ton of assemblies.

Also, that whole stuff is still in preview by microsoft.

Aaand paket 5 can't even resolve these preview packages ...

So I don't think we should enable it by default.

Either disable, or a toggle somewhere.

@matthid
Copy link
Member

matthid commented Jun 2, 2017

Yeah it needs to work is the minimum bar ;)

We can warn or fail if we detect that, but let's first fix the current bugs...

@matthid
Copy link
Member

matthid commented Jun 2, 2017

I guess fixed in 4.8.7. Thanks for taking care of this.

@matthid matthid closed this as completed Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants