I have a WPF Application, WpfApplication1, and I'm referencing a WPF User Control library, WpfControlLibrary1. In the WpfControlLibrary1, I'm referencing Telerik.Windows.Controls. When I build and run (F5) the WPF Application, I get a XamlParseException - Could not load file or assembly...
I'm using a RadButton in a UserControl in the WpfControlLibrary1.
Checking the Debug\bin folder of the WpfApplication1, I can see the WpfControlLibrary1 was copied into the folder, but the Telerik.Windows.Controls.dll dependency from WpfControlLibrary1 as not copied.
If I add the reference to the WpfApplication1, it works but I shouldn't have to do that should I? Shouldn't it figure out the dependencies and copy them from the child projects as necessary.
You are correct that Visual Studio automatically copies the referenced assemblies to the output directory, but only if it detects that something from that assembly reference chain is used. You can check the attached example project for that. However the problem here is that Visual Studio do Not detects the usages in Xaml, so it doesn't copy some of the assemblies to the output dir, thus the application crashes at run-time.
You can test this by removing the line that instantiate Class1 in the WPF app and instead create instance in xaml like <classlibrary1:Class1 />. The second way it won't copy the assemblies to the output dir.
Hope this help you.
All the best,
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Public Issue Tracking
system and vote to affect the priority of the items
Another way I thought of to get this 'code-behind' hack to work was to add a Name element to the control so it would then create the stronger reference in the UserControl1.g.cs generated file. That way I don't have to instantiate a class in the code-behind. But really, either way works.