vs2015中复制C++ DLL 和.pdb文件到C#工程中bin目录的设置方法

在C#工程上面右击选择  -->Properties --> Build Events --> Post-build event command line  , 选择 Edit Post-build ...
然后在里面编辑:
xcopy /r /y "$(SolutionDir)x64$(ConfigurationName)GetHeight.dll" "$(TargetDir)"
xcopy /r /y "$(SolutionDir)x64$(ConfigurationName)GetHeight.pdb" "$(TargetDir)"
 
其中:
xcopy /r /y : 复制标记符号
$(SolutionDir) : 解决方案的相对路径
$(ConfigurationName) : Debug / Release 的选项
$(TargetDir) : 目标文件的相对路径
nativeCPP.dll ; 需要复制的文件名
(可以用相对路径,也可以用绝对路径,  不过,建议用相对路径,可以点击Macros按钮查阅定义符号,如下图)
 
如下图:
 
 
原文地址:https://www.cnblogs.com/qiushui127/p/7147229.html