0

I'm writing a WinRT-based library in C# (here's the source code) where I expose a custom XAML control called AppView. When I compile the library locally and use it from my sample app, it seems to be working fine. However, if I upload it to NuGet and use it like this:

public MainPage()
{
    new AppView();

    this.InitializeComponent();
}

then I get a XamlParseException when the constructor is called. I followed this suggestion of breaking in the debugger when it was thrown, but unfortunately it just says 'XAML parsing failed.' and the InnerException is null.

These problems have been happening ever since I factored out part of my library into another DLL. So far, I have tried:

  • including the other DLL (commit)
  • including everything in the Release directory (commit)
  • publishing the other DLL as a separate NuGet package

If you're interested in repro-ing this for yourself, here's the link to the package on NuGet.


edit: Added the [wpf] tag since that platform is also closely related to XAML.

Community
  • 1
  • 1
James Ko
  • 32,215
  • 30
  • 128
  • 239

1 Answers1

4

Well, it looks like I've answered my own question! Following the excellent steps listed here worked for me. All I had to do was go into my project's Properties > Build and check Generate library layout. I then updated my nuspec file to just include everything in the output directory, like so:

<file src="bin\Release\**" target="lib\.NETCore50" />

After that, everything worked perfectly.

Community
  • 1
  • 1
James Ko
  • 32,215
  • 30
  • 128
  • 239