问题
Trying to figure out how to package the following solution with Visual Studio 2017 Desktop Bridge (Application Packaging Project):
- .NET Library DLL.
- WinForms executable referencing 1.
- 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