Pack URI to resources in referenced assembly

Viewed 3773

I've been banging my head over this for some time, but for the love of god, I just cant figure out whats wrong with my uri. Maybe someone could help.

I'm developing an addin for a third-party software (means I have no access to App.config and cant modify application itself). The addin is located in a folder that differs from location of the exe file. I have a wpf window located in MyAddin.View.dll. Recently I've decided to move all WPF resources in a separate assembly (called UI.Shared). I've added UI.Shared.dll as a reference to MyAddin.View.dll, I've also modified my pack uri inside MyAddin.View.dll window to this:

<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary
         Source="pack://application:,,,/UI.Shared;component/Styles/Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

</Window.Resources>

I've made sure that Style.xaml Build Action is set to Resource. The UI.Shared.dll is located in the same folder as MyAddin.View.dll (but both of them are NOT in the same folder as application executable). Everything works fine at design time. But during run-time, I get:

"Set property 'System.Windows.ResourceDictionary.Source' threw an exception."

And the inner exception says:

Could not load file or assembly 'UI.Shared, Culture=neutral' or one of its dependencies. The system cannot find the file specified.

Everything worked just fine before I've moved resources into a separate assembly:(. Could someone please help?

1 Answers
Related