.NET Standard support broken in Xamarin?


It seems that .NET Standard support is completely broken in Xamarin.iOS and maybe in Android and Mac as well. My simple project with a reference to 'AutoMapper' library does not compile with error like this - "The type `System.Object' is defined in an assembly that is not referenced."
Steps to reproduce:
1. Create iOS Library project
2. Add AutoMapper package or any other package targeting netstandard and not targeting xamarinios10.

I've spent last couple of days trying to figure out what going on and this is what I was able to find so far:
1. iOS Library cannot use netstandard packages at all. Compilation fails with error above.
2. iOS Library can be compiled if I turn ok experimental msbuild support and restart Studio. IDE still complains on missing types.
3. NetStandard library created in Xamarin Studio can reference other netstandard libs but IDE display lot of warning like this - "Assuming assembly reference 'System.Runtime...' matches identity 'System.Runtime...'"
4. I think problem is in 'ResolveAssemblyReferences' build target which outputs 'DependsOnSystemRuntime' variable which is false. If I hack build process to make it 'true' my build suddenly works. To be more specific I hack into 'ImplicitlyExpandDesignTimeFacades' which uses 'DependsOnSystemRuntime' which in turn produced by 'DependsOnSystemRuntime'. I also noticed some hacks about 'System.Runtime' in 'ResolveAssemblyReferences' task source code.

Any help or advice highly appreciated.




  • mikeacostamikeacosta USUniversity ✭✭✭

    Regarding the "Assuming assembly reference 'System.Runtime...' matches identity 'System.Runtime...'" warnings, I got rid of those by changing the PCL target framework from .NET Standard 1.5 to 1.4.

    FWIW, I have another sol'n targeting .NET Standard 1.4 that references Automapper 4.1.1 in the PCL only (not platform projects) and it builds fine.

Sign In or Register to comment.