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

System.Runtime.InteropServices.RuntimeInformation fails to install in Classic PCL with NuGet 2.x #10445

Closed
onovotny opened this Issue Jul 30, 2016 · 24 comments

Comments

@onovotny
Copy link
Member

onovotny commented Jul 30, 2016

The System.Runtime.InteropServices.RuntimeInformation package will fail to install on NuGet 2.x because there is no lib\netstandard1.1 version. There is only a runtimes\win\lib\netstandard1.1 version, but as NuGet 2.x doesn't understand runtimes, it'll fail.

This affects installing .NET Standard Libraries into a PCL Profile 111 as it's included by NETStandard.Library when evaluating dependencies for pcl profiles.

To repro:

With VS 2013 and NuGet 2.12

  • Create a new PCL targeting .NET 4.5, Windows 8 and Windows Phone 8.1 (Profile 111).
  • In the NuGet package manager, try to install the S2Geometry library

Actual results

Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets 'portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

The S2Geometry library is a netstandard1.0 library and follows the advice of having a dependency on netstandard.library 1.6.0.

/cc @ericstj

@onovotny

This comment has been minimized.

Copy link
Member Author

onovotny commented Jul 30, 2016

Are there other packages in the same situation as well?

@DamienDennehy

This comment has been minimized.

Copy link

DamienDennehy commented Jul 31, 2016

I'm running into this issue using VS2015 Update 3 and both a Profile44 and Profile111 library.

To repro:

With VS 2015 Community Update 3 and NuGet 3.5

  • Create a new PCL targeting either Profile44 or Profile111.
  • Try to install System.Runtime.InteropServices.RuntimeInformation 4.0.

Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework.

@ericstj

This comment has been minimized.

Copy link
Member

ericstj commented Aug 1, 2016

To workaround use project.json in the PCL.

@onovotny

This comment has been minimized.

Copy link
Member Author

onovotny commented Aug 1, 2016

That workaround doesn't work for VS 2013 or 2012.

@ericstj

This comment has been minimized.

Copy link
Member

ericstj commented Aug 1, 2016

Yeah, keeping this bug open to track how to fix that. We could drop a reference assembly or some sort of default implementation into lib/netstandard1.1.

@ericstj

This comment has been minimized.

Copy link
Member

ericstj commented Aug 3, 2016

Across all of our packages, if they have a ref with netstandard version 1.2 or lower, and no RID-less implementation, we should consider exposing a reference assembly or PlatformNotSupported assembly in lib/netstandard so that they can be used by profile-based portable w/ packages.config.

@juanfranblanco

This comment has been minimized.

Copy link

juanfranblanco commented Sep 2, 2016

Any update on this?

@ericstj

This comment has been minimized.

Copy link
Member

ericstj commented Sep 7, 2016

No fix as of yet. Also adding @Priya91 to look at a potential lib/NETStandard1.1 implementation of RuntimeInformation that isn't platform specific.

@g0t4

This comment has been minimized.

Copy link

g0t4 commented Oct 11, 2016

I've had luck installing a netstandard1.1 library into a PCL with Profile111 by not installing dependencies (NETStandard.Library). Everything I need is in the Available Assemblies https://developer.xamarin.com/guides/cross-platform/advanced/available-assemblies/ ... I've also had luck so long as I don't target the entire NETStandard.Library and instead use fine-grained package refs to only what I need (and obviously then those packages are compat)

@Priya91

This comment has been minimized.

Copy link
Member

Priya91 commented Oct 24, 2016

Looking into dropping windows implementation from runtimes to lib/netstandard1.1..

@pbrns

This comment has been minimized.

Copy link

pbrns commented Dec 2, 2016

anything with this issue? i try to install via nuget autofac libraries with this message:
Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

@alshyr

This comment has been minimized.

Copy link

alshyr commented Dec 5, 2016

Would be nice to get it fixed soon

@okosodovictor

This comment has been minimized.

Copy link

okosodovictor commented Dec 5, 2016

This work for me.
When i ran into that issue today. I had to install System.Runtime.InteropServices.RuntimeInformation before i install autofac.

  1. Install-package System.Runtime.InteropServices.RuntimeInformation
  2. install-package autofac
    That just work for me.
@Priya91

This comment has been minimized.

Copy link
Member

Priya91 commented Dec 5, 2016

This is fixed in 1.1.0.. will be available in .net core 1.1 packages.

@IsmaelMendonca

This comment has been minimized.

Copy link

IsmaelMendonca commented Jan 6, 2017

@okosodovictor that worked for me too, thanks a lot man!

@ghost

This comment has been minimized.

Copy link

ghost commented Jan 9, 2017

Despite @Priya91's comment that it was fixed in 1.1.0, I had to follow @okosodovictor's suggestion before I got it working.

@godrose

This comment has been minimized.

Copy link

godrose commented Feb 2, 2017

When using @okosodovictor 's suggestion make sure that the dependency behaviour is set to 'Highest' in nuget package manager.

iainmerrick added a commit to iainmerrick/ink that referenced this issue Feb 9, 2017

Change NuGet target framework to "netstandard1.0"
This should make the DLL that we publish via NuGet as compatible
with as many different consumers as possible. This creates a
portable library that's usable from Mono, Xamarin, Windows Phone
and Windows.

Notably, it is *not* usable from Unity (which still uses an
older runtime based on .net 3.5) but Unity has a separate packaging
scheme and doesn't use NuGet.

Note: according to the MS docs, I should just need a single dependency
on "NETStandard.Library", but that doesn't work, apparently due to a
bug in NuGet (dotnet/corefx#10445). I've
therefore used a workaround suggested in that bug report, and
explicitly listed the various System.* packages we depend on.
@mcachopas

This comment has been minimized.

Copy link

mcachopas commented Feb 20, 2017

@okosodovictor thank you very much, it worked to me

My error was on installing sqlite-net-pcl in a solution with xamarin

@DanielCauser

This comment has been minimized.

Copy link

DanielCauser commented Feb 26, 2017

@okosodovictor Thank you man, this solved the issue while trying to install sqlite-net-pcl on xamarin studio on a xamarin.forms project.

@vdangwal

This comment has been minimized.

Copy link

vdangwal commented Apr 26, 2017

I was trying to use this with Xamarin Native targeting Profile 111 in PCL project. I was trying to install sqlite-net-pcl and it failed. After installing System.Runtime.InteropServices.RuntimeInformation first and then install sqlite-net-pcl, it worked like charm. :) 👍 thanks @okosodovictor

@rndoherty

This comment has been minimized.

Copy link

rndoherty commented May 16, 2017

Thanks @okosodovictor !! Like others here, I was installing sqlite-net-pcl for a Xamarin.Forms PCL project in Visual Studio 2017 and your suggestion worked perfectly.

@vinguan

This comment has been minimized.

Copy link

vinguan commented Jun 1, 2017

@okosodovictor You are the real MVP.

@Goobae

This comment has been minimized.

Copy link

Goobae commented Jun 14, 2017

Followed @okosodovictor advice, still could not install sqlite-net-pcl vs 2017.

Just kidding. Forgot that package management console applies to one package at a time.... this worked.

@dotnet dotnet deleted a comment from kokomola Jul 6, 2017

@karelz

This comment has been minimized.

Copy link
Member

karelz commented Jul 6, 2017

@kokomola your comment was deleted as a violation of the .NET Foundation Code of Conduct (adopted by CoreFX repo) as it was insulting/derogatory. You may consider this an official warning.

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