Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referenced library isn't copied

I have ProjectA(WPFApplication) that references ProjectB(ClassLibrary). Inside ProjectB i have wpf window that uses control from ThirdParty.dll wich i accordingly reference from ProjectB.

The problem is that it doesn't find ThirdParty.dll in output folder of ProjectA and xaml parse runtime exceprion is raised. There is no ThirdParty.dll in GAC. Copy Locally is set to true. It works if i manually add in output folder of ProjectA that library and it also works if i use that ThirdParty.dll somwhere right in my cs files.

How can i solve that?

like image 356
Vladimir Nani Avatar asked Sep 05 '11 09:09

Vladimir Nani


2 Answers

The reason for this is that visual studio only copies resources to the output folder if Copy Local is set. Just set the reference to Copy Local and you should be fine.

Check out this link on how this works.

When you reference ProjectA, the references from ProjectB is not automatically referenced. For this to work, you need to add a reference to ThirdParty.dll from ProjectA as well if you only use it in XAML. The compiler does not copy references that are only used in XAML. But if you use them in code, they are copied.

This is the same issue as discussed here

like image 62
Oskar Kjellin Avatar answered Oct 22 '22 09:10

Oskar Kjellin


You should add the reference to the thrid party dll to the project where you want it to appear in the output directory. If the Copy Local is then set to true it will appear in you bin directory whether or not you use it in code or xaml.

like image 21
albertjan Avatar answered Oct 22 '22 09:10

albertjan