Search code examples
c#wpfreferenceresourcedictionary

Assembly 'SharedProject1' is not referenced by this project


So I have a WPF project and a SharedProject in one solution.

The SharedProject has a ResourceDictionary file. I made a reference to the SharedProject from my WPF project.

enter image description here

But when I try to reference the ResourceDictionaryit gives the message: 'Assembly 'SharedProject1' is not referenced by this project'.

<Window x:Class="WPF.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ietstesten"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <ResourceDictionary Source="pack://application:,,,/SharedProject1;component/Dictionary1.xaml" />
</Window.Resources>
<Grid>

</Grid>


Solution

  • You should add your ResourceDictionary to a WPF Custom Control Library project or a WPF User Control Library project and reference this one.

    A Shared Project is not compiled:

    What is the difference between a Shared Project and a Class Library in Visual Studio 2015?