Reputation: 1338
At my job we've been running into an issue regarding project references lately.
I have one entry project called EntryPoint
which references my main project, called MainProject
. My main project has a reference added to another important project called ImportantProject
, which contains an important ResourceDictionary
in a file called ImportantResources.xaml
.
I have a Window
in my main project which uses the important ResourceDictionary
with the following code:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ImportantProject;component/ImportantResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
While I am designing my Window
everything works flawlessly, I have full access to the important project's resources. However when I run my program, it immediately crashes.
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
Additional information: 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '11' and line position '18'.
When I look at my output folder (/EntryPoint/bin/Debug
), I notice that there is no ImportantProject.dll
file, which I assume is why the crash is happening.
How can I make sure the .dll file appears in the output folder?
I would like a global solution, which works for all Important
projects that might appear in the future if possible.
Here's a full code sample on GitHub
Upvotes: 0
Views: 171
Reputation: 1847
EntryPoint doesn't appear to have a reference to ImportantProject. If you add the reference to ImportantProject, it runs fine.
If you have project A that references project B that references project C, then project A needs to have references to both projects B and C.
Upvotes: 1