C# – Can’t create xmlns reference to other project in XAML


I have a WPF project defined like this:


In one of my xaml files in the MyAppWPF project I'm trying to reference a class defined in MyApp.Domain project. I have a project reference in MyAppWPF to MyApp.Domain. I am trying to create the reference like this:

<Window x:Class="MyAppWPF.Window1"
    Title="Window1" Height="305" Width="485">
       <local:MyClass x:Key="mine" />

I get an error saying the assembly cannot be found, however I can create an instance of the class I want to reference in the code behind, so I know I've got it referenced correctly.

How do I do this? Do I need a strong name, or reference the dll directly instead of using a project reference?

Best Solution

Check if

  1. the fully qualified name for MyClass is MyApp.Domain.MyClass
  2. MyClass has a default public constructor (with no parameters) so that XAML can instantiate it.
Related Question