I need to make use of a UserControl defined in a Universal Windows class library from a UWP project which takes that class library as a dependency. (Both assemblies are mine.) In previous projects, when the project implementing the UserControl was part of the same solution, this worked fine. For my current project, I'm instead consuming the class library as a NuGet package. When trying to consume the UserControl from the NuGet package, everything builds but a XamlParseException is immediately thrown when loading the page which includes the UserControl at runtime.
I found this related question, which lead me here, which was enlightening (it seems a generated binary file for the user control isn't automatically included in NuGet packages for some reason), but the proposed solution doesn't fit my needs. The recommendation appears to be to move certain output files (*.xr.xml, *.pri, *.xbf) manually from one project's 'bin' to the other's, but this doesn't seem sustainable. If including these specific files in the NuGet package is the answer, then how can I do so automatically? Can I provide some specific set of parameters to 'nuget pack'? If I need to include a .nuspec file, what do I need to include in order to get the right files?
Some additional background on my project and workflow in case it's relevant: I'm building a cross-platform app using Xamarin and MvvmCross, currently targeting UWP and Android. The class library defining my user control is a Universal Windows class library which my UWP project depends on. I'm using Visual Studio Team Services to host repos for each of my assemblies; upon check-in, they are automatically built, tested, packaged, and published to an internal feed, where they may be acquired by projects which depend upon them. I'm looking for a solution which enables me to automate the inclusion of all required output files in my NuGet packages so that I can preserve this level of automation.
Short answer is no. There is no set of commands at this time that will make this work magically. You will have to manually specify the set of the files that is required.
An additional note is that you probably dont need to include the .xbf file in the NuGet package. The XAML Compiler will convert all the Xaml files (unless overriden) to .xbf, even those coming in from referenced Extension SDK's or NuGet Packages. However you do need to include the Xaml file since this will both enable the Xaml designer to work and is the input to the Xaml Compiler.
You could also look into writing a script that reads the csproj and updates the nuspec as required with the content that is needed as a pre packaging and post build step.
A good read around this topic is Tim Heuer's post here