runtime: System.Runtime.InteropServices.RuntimeInformation fails to install in Classic PCL with NuGet 2.x

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

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

@okosodovictor You are the real MVP.

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.

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

@okosodovictor thank you very much, it worked to me

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

To workaround use project.json in the PCL.