C++ project dependency for .NET Core project

时间秒杀一切 提交于 2019-12-07 11:13:07

问题


I have solution with .NET Core project and C++ project. .NET Core project uses compiled C++ library via interop and DllImport. How can I configure my build process properly? I would like to have:

  1. Native library is built
  2. Native library is copied to output directory to my main application

Is it possible to do that with project.json and "dotnet build/publish" command?


回答1:


Open the property window of your native C++ project. Find Build Events/Post-Build Event/Command Line. Then input the following commands to copy the built dll and pdb files to the output directory of your main application.

xcopy /Y /S "$(OutDir)*.dll" "E:\output_directory_to_my_main_application"
xcopy /Y /S "$(OutDir)*.pdb" "E:\output_directory_to_my_main_application"


来源:https://stackoverflow.com/questions/38527221/c-project-dependency-for-net-core-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!