How to make Visual Studio copy a DLL file to the output directory?

前端 未结 6 965
广开言路
广开言路 2020-11-27 12:47

I have a Visual Studio C++ project that relies on an external DLL file. How can I make Visual Studio copy this DLL file automatically into the output directory (debug/releas

6条回答
  •  孤街浪徒
    2020-11-27 13:31

    (This answer only applies to C# not C++, sorry I misread the original question)

    I've got through DLL hell like this before. My final solution was to store the unmanaged DLLs in the managed DLL as binary resources, and extract them to a temporary folder when the program launches and delete them when it gets disposed.

    This should be part of the .NET or pinvoke infrastructure, since it is so useful.... It makes your managed DLL easy to manage, both using Xcopy or as a Project reference in a bigger Visual Studio solution. Once you do this, you don't have to worry about post-build events.

    UPDATE:

    I posted code here in another answer https://stackoverflow.com/a/11038376/364818

提交回复
热议问题