用户控件在执行时有额外的库没有被找到

User control has additional libraries not being found when executing

我正在开发一个 WPF 解决方案,我在一个单独的(包含的)项目中有一个用户控件,这个用户控件引用了 c++ dll,包含在一个 post 脚本中:

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

问题是主项目在执行时没有找到这些dll。

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

我想我需要分发我的 Bin 文件夹中的全部内容。

如何在主项目中包含这些额外的 dll?

您可以将主项目和用户控件的输出设置到同一个文件夹。 分别右击,然后selectBuild,Output,Output path,设置同一个目录,保存。 所有输出都将转到同一目录,因此您将访问所有资源。