Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Write platform specific code in a .NET Standard Library project?

$
0
0

I started out using a .NET Standard Library project - to which I intend to build a NuGet out of in the future. But I found myself needing to write platform specific code.

I have seen approaches of editing the csproj file here and here - to add more targets. And I have also seen the Multiplatform Library library project type.

But using Multiplatform I found a NuGet package breaking:

Could not install package 'NObservable 0.1.1'. 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

which assume is because the target with that library type becomes NETPortable instead of netstandard2.0.

Can I add more targets to the .NET Standard Library project by editing csproj to be able to write platform specific code - or will I have to use the Multiplatform library type - and delete the NuGets that are breaking? Is it possible to use .NET Standard and write platform specific code?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>