CocosSharp nuget package for net standard 1.*

Hi, I've been updating my Xamarin.Forms app to use net standard libraries instead of PCLs but have hit a problem adding the CocosSharp package as it does not seem to be .Net standard enabled. I was previously using the CocosSharp for Xamarin.Forms package as I use the CocosSharpView in my app but this will no longer install with my .Net standard library. I'm a bit confused as I understood you could reference PCLs from .Net standard libraries but not vice versa.

I can see from looking on github that the CocosSharp.PCL project does appear to have been updated to v1.7.1 and has a version of the CocosSharpView.cs class, could someone please explain to me what my options are to enable me to use this with my .Net standard libraries.

Thanks, P.

Best Answer


  • mattwardmattward GBMember Xamurai

    You can reference PCLs from .NET Standard projects if you explicitly indicate the PCL profile is compatible. If you are using .NET Standard version 1 you can do this by adding a PackageTargetFallback. If you are using .NET Standard 2.0 then this property has changed to AssetTargetFallback.

  • bittersweet69bittersweet69 GBMember ✭✭

    Hi Matt,

    I'm setting PackageTargetFallback as follows to try to get CocosSharp PCL package to load:-


    Seems like CocosSharp PCL may also want net40 setting, the package output console error is:-

    Package CocosSharp.PCL.Shared 1.6.2 is not compatible with netstandard1.0 (.NETStandard,Version=v1.0). Package CocosSharp.PCL.Shared 1.6.2 supports:
    - monoandroid10 (MonoAndroid,Version=v1.0)
    - net40 (.NETFramework,Version=v4.0)
    - netcore (.NETCore,Version=v0.0)
    - portable-net45+win+wp81+wpa81 (.NETPortable,Version=v0.0,Profile=net45+win+wpa81+wp81)
    - wpa81 (WindowsPhoneApp,Version=v8.1)
    - xamarinios10 (Xamarin.iOS,Version=v1.0)

    If I add net40 then I get compatibility issues with other packages (Xamarin.Forms, etc...). I'm a bit surprised no one else has hit this issue. If I have to build CocosSharp myself are there any docs on doing this?


  • mattwardmattward GBMember Xamurai

    Also .NET Standard 1.0 is not compatible with some PCL profiles.

Sign In or Register to comment.