Errors when packaging app referencing PCL

I ran into what seems a really strange bunch of errors the other day while trying to build store packages for a UWP application.

There were about 15k (yes, 15 thousand!!!) errors that only showed up when building store packages. The application would compile and run fine in debug, but as soon as you try to build the package it would error out. See below:

Bing didn’t help much so I started to backtrack my steps from the previous days and try and get to the bottom of it. Notice from the error list that there’s one library name that keeps coming up, but that was not referenced in my main project.
So I started looking for it in the other projects I was referencing and it wasn’t long before I found it, in a Portable Class Library that was targeting a number of other platforms like Xamarin.

Turns out I’d written a new method that had a UIElement parameter which got me to unknowingly add a reference to Windows.Foundation.UniversalApiContracts library.

I understand that this should work since I believe this is the precise reason why the library was written in the first place but I couldn’t get it to package my app. Considering I didn’t really need the UIElement in my PCL, I gladly implemented a workaround and remove the reference.

Share Comments