August 29, 2017 - I just wrote a blog on sharing code with .NET Standard 2.0 Libraries:
I would add that UWP support for .NET Standard 2.0 is in preview
EDIT: Nevermind, apparently I can't read
Just upgrades to the alpha channel (VS for Mac) and installed .NET STandard 2.0.
I am disappointed about the lack of cross platform progress:
1. I still cant use Xamarin Forms to make apps that work on Desktops & Mobiles.
2. I still cant use WebViews for Desktops & Mobiles. Only IOS and Android.
Either that or the New Solutions Pane / Wizard is too simplistic....
If anyone can steer me in the right direction on the webviews that would be fab...
There are webview samples here: https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithWebview
But nothing for Mac.
@JamesMontemagno do you see significant impact on startup performance for applications referencing .net standard libraries, particularly on Android. We noticed a black screen appearing between splash and the main page of our xforms application when we reference a .NET Standard 1.0 library - I understand that the black screen can be fixed by correctly setting theme but it points to a longer load time which only started happening when we referenced the .net standard library. Is this a known impact? Is there a way to optimise build to reduce this load time?
@NickRandolph i don't have performance tests or anything like that, but technically there should be no difference as it is just a library. Some NuGets you reference may pull in a lot of dependencies and ideally over time those will go away so less references would help with load time.
@JamesMontemagno thanks for that - I did notice that even with the new XForms preview, which I thought was going to be a .NET Standard library is still a PCL. In the release notes it states that "Xamarin.Forms is now compatible with .NET Standard projects!" but wasn't this the case before? I was expecting XForms to be net standard libraries.
I mean PCLs are always compatible with .NET Standard projects. Always have been.
2.3.5 and 2.4.0 are all based on .NET Standard Libraries so easily install into .NET Standard projects.
@JamesMontemagno I could be wrong but the xamarin forms libraries are all still PCLs, even in 2.4.0 (at least that's what my understanding is on the assembly attribute: [assembly: TargetFramework(".NETPortable,Version=v4.5,Profile=Profile259", FrameworkDisplayName = ".NET Portable Subset")]. So I'm not sure what you mean by "based on .NET Standard Libraries"?
@JamesMontemagno Is there anything specific that needs to be done to use shared code from a .NET Standard Library (2.0) with a Xamarin.iOS project? I'm currently using the 7.2 alpha VS on Mac OS. When I attempt to reference symbols from my library, I receive the following errors:
Error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=18.104.22.168, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. (CS0012) (App.iOS)
Error CS0012: The type 'MulticastDelegate' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=22.214.171.124, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. (CS0012) (App.iOS)
Thanks for any suggestions!
@mikeartfay I ran into the same problem. I found a few references to similar problems, but none of the suggestions helped.
I found a workaround for my situation: manually add "...\Microsoft Visual Studio\2017\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Facades\netstandard.dll" as an assembly reference to your iOS project.
You really shouldn't have to do this because of .NET Standard implicit reference build magic, but the build system is broken right now (as of VS 15.3.4).
Is there a chance of supporting .net standard 2.0 with Xamarin forms in the near future across IOS, android and UWP projects. This will allow maximum code sharing across all platforms I believe.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies