How to make Visual Studio copy the necessary .dll files to the release folder?

I am using Visual Studio 2012 with C ++, creating Qt .

I can compile it and debug it, but somehow the .dll file is in the Debug or Release folder. I tried some other messaging solutions but no one worked.

So, how can I get Visual Studio to copy the necessary .dll files to the release folder?

I think this should be an option somewhere. I'm just starting to think about copying it manually.

+6
source share
2 answers

Too many bad tips, a DLL cannot be a resource. Windows requires code to be stored in a separate executable file with the appropriate PE32 header. This allows you to create a file with memory mapping to map the contents of the file to memory, allowing the code to share several processes and not fit it into the swap file. And move the code when the base address of the DLL is already in use.

Just use Project + Properties, Build events, Post-Build Event for xcopy DLL. Arbitrarily, if you saved the necessary DLLs in the "dlls" subdirectory of your project, then this command will copy them, only if necessary:

xcopy /d /y "$(ProjectDir)dlls\*.*" "$(OutDir)" 

Use it in both Debug configuration and Release so that you debug exactly what you send.

+22
source

Add your .dll files as resources to your project. Thus, your .dll files will be located in the resources folder in your project.

Try Add Item...New Item... and add the resource file ( .qrc ) to the project and add .dll files to it.

-2
source

Source: https://habr.com/ru/post/958297/


All Articles