Search code examples
c#wpflibrariesdllnotfoundexception

User control has additional libraries not being found when executing


I am working on a WPF solution, I have a user control in a separate (included) project, this user control references c++ dlls, included by a post script:

xcopy "$(ProjectDir)x64\*.dll"  "$(TargetDir)"  /Y /E /C /F

The issue is that the main project is not finding these dlls when executing.

Message "Unable to load DLL 'libhelper.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

I think I need to distribute the whole content of my Bin folder.

How can I include these additional dlls in the main project?


Solution

  • You can set the output of your main project and the user control to the same folder. Right click on each of them, then select Build, Output, Output path, set the same directory and save. All the output will go to the same directory therefore you will access all resources.

    enter image description here