views:

264

answers:

1

Hi,

I posted this question on the MSDN forum but haven't been able to receive much of an answer, so decided to try it out here.

I'm having a problem with dependency libraries of a project not being copied to the output directory of a second project that references it, when the first library is mostly xaml. Here is a typical scenario when this happens

SolutionX
    - SomeControls.Dll { contains wpf user controls }
         external reference: WPFTheme.dll*
    - MainApp.Exe
        project reference: SomeControls.dll

Commonly what happens here is that when building the solution, WPFTheme.dll is not copied to the output directory of the MainApp.Exe project. (* this also works if referencing a third project instead of an external)

I usually use a post build event to handle this situations... but i found the problem was intermittent.

If I don't reference ANY of the classes in WPFTheme.dll in my c# code but I do so in xaml, then as said before the WPFTheme.dll library doesn't get copied.

BUT if i reference Any class (even just assigning them null) from some c# in the project (even backend xaml.cs class) - then everything works as one would expect.

So has anyone else encountered this problem? Is there a way to force the library to get copied if referenced by xaml?

Just to add more info... all this happens with libraries that show up as external in the project file with a relative path in the HintPath.

Thanks everyone,

K

A: 

I have this exact same issue with dependency injection through reflection, i get around it with post build events and when deploying nant scripts, sorry i couldnt be more help, look forward to seeing a solution, you can always just add the refs to the startup project directly, can get into some fun issues with that long term but it will work

Brandon Grossutti
It is so absolutely true that you will get into some fun (not!) issues by handling the problem with direct references to the startup project. The post build works, and is already doing other things other than resolving this issue. But it still baffles me is that if you reference it in code then it all works - it means it will work for some libraries but wont for others!
CtzKane