Search code examples
xamarinreferenceuwpportable-class-library

Why is my reference not being compiled in Xamarin Windows Universal PCL?


I have a Xamarin PCL that works successfully with Android. I followed the instructions to add a Windows Universal Project to the Solution found here:

https://developer.xamarin.com/guides/cross-platform/xamarin-forms/windows/getting-started/universal/

But I am having issues running it.

When I build my project x86 I get the warning:

warning : Method 'project.ctor()' will always throw an exception due to the missing method 'ImageSource.FromResource(string)'. There may have been a missing assembly.

Then when I run the code I get exception

Additional information: Method 'ImageSource.FromResource(string)' was not included in compilation, but was referenced in SturgisMainPage..ctor(). There may have been a missing assembly.

When I build my project x64 I get the same build warning, but the exception is

An exception of type 'System.NotImplementedException' occurred in App1.Interop.dll but was not handled in user code

Additional information: Arg_NotImplementedException

How do I make sure to compile the reference. The only reference I have is to the NuGet Package in the instructions which is Xamarin.Forms.


Solution

  • On the add reference step, I added the Xamarin 2.0 Nuget Package to the Universal Project, but my Portable Class Library project was set to 1.0. I updated my Portable Class Library Xamarin Nuget Package to 2.0 and then it ran just dandy.