Packaging WinForms application along with native DLL

微笑、不失礼 提交于 2019-12-23 02:13:10

问题


Trying to figure out how to package the following solution with Visual Studio 2017 Desktop Bridge (Application Packaging Project):

  1. .NET Library DLL.
  2. WinForms executable referencing 1.
  3. Native C++ DLL exporting some functions used by 1 and 2 with [DllImport].

I added project 2 to Applications section of a package and buit it. In the target folder I have EXE (from project 2) and DLL (from project 1).

And the question is: how to correctly add the project 3 (native c++ library) to a package? I have x86 and x64 project configurations for this DLL.


回答1:


Here is how to do it - see screenshots below for illustration:

1) create a folder in your Winforms project as the target for your native DLL(s)

2) add a post-build event step to copy the native DLL to that folder

3) in that folder, mark the DLL as part of the project

4) Make sure properties are set to "Content" and "Copy to output"

5) now the packaging project will pick up the native DLL and include it in the package



来源:https://stackoverflow.com/questions/48754557/packaging-winforms-application-along-with-native-dll

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