title: Creating DLL that contains a ResourceDictionary
body: <p>I have created a new WPF-Project. After creating the project, I changed the project properties to <strong>outputtype = classlibrary</strong>. </p>
  
  <p>Here is my file structure:</p>
  
  <p><a href="https://i.stack.imgur.com/bBxJ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bBxJ1.png" alt="enter image description here"></a></p>
  
  <p>The <code>CustomWindow.xaml</code> is a ResourceDictionary which discribes the appearance of the <code>CustomWindow.cs</code>. 
  The file <code>CustomWindow.xaml</code> looks like</p>
  
  <pre><code>&lt;ResourceDictionary x:Class="WpfApplication1.CustomWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"&gt;
  
    &lt;Style x:Key="MainWindow" TargetType="{x:Type Window}"&gt;
       &lt;Setter Property="Template"&gt;
           &lt;!-- ... --&gt;  
       &lt;/Setter&gt;
    &lt;/Style&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>The class <code>CustomWindow.xaml</code> looks like</p>
  
  <pre><code>namespace WpfApplication1
  {
      public partial class CustomWindow : ResourceDictionary
      {
          public CustomWindow()
          {
              InitializeComponent();
          }
      }
  }
  </code></pre>
  
  <p>Now I added to the <code>App.xaml</code> following</p>
  
  <pre><code>&lt;Application x:Class="WpfApplication1.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
      &lt;Application.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;!-- Common base theme --&gt;
                  &lt;ResourceDictionary Source="pack://application:,,,/WpfApplication1;component/CustomWindow.xaml"/&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>I changed the <strong>property buildprocess of the file <code>CustomWindow.xaml</code> to <code>Page</code></strong>.</p>
  
  <p>After that I build the lib. Now I want to use the style <code>MainWindow</code> for my new project's main window. I've added the lib to the project references. And to the <code>App.xaml</code> I added some lines of code:</p>
  
  <pre><code>&lt;Application x:Class="WpfApplication2.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               StartupUri="MainWindow.xaml"&gt;
      &lt;Application.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;!-- Common base theme --&gt;
                  &lt;ResourceDictionary Source="pack://application:,,,/WpfApplication1;component/CustomWindow.xaml" /&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>I tried to build it, but I become two error's.
  The first</p>
  
  <blockquote>
    <p>The resource "MainWindow" couldn't be find.</p>
  </blockquote>
  
  <p>The second</p>
  
  <blockquote>
    <p>An error occurred while finding the resource dictionary "pack://application:,,,/WpfApplication1;component/CustomWindow.xaml".</p>
  </blockquote>
  
  <p>Maybe someone of you got an idea.</p>