1

Is there a way to deploy a Qt desktop application that is compiled using MSVC in such a way that it will be "portable" (just run exe from a folder, not install anything, not even install VC_redist)?

Of course, it is possible to use it if Microsoft Visual C++ Redistributable is installed on target computer, but is it possible to make it run without installing it (eg. by putting some dll from vcredist to application's folder)?

Jiří Maier
  • 177
  • 7
  • If you can statically link to the MSVC/C++ runtime you should be able to distribute without the DLLs. I think it is in the code generation. In the Runtime Libraries area. For debug choose "Multi-threaded Debug" and for release choose "Multi-threaded" – Joseph Willcoxson May 11 '21 at 23:18

2 Answers2

0

If you build/link your application statically, you will only have 1 .exe without DLL. The second way is to build your app with shared libraries and at runtime your app will search those DLL in PATH and in the current directory so you just need to put all your needed DLL in this folder. How do you manage your Qt library ?

  • For Qt libraries, I use windeployqt to add these DLLs to application's folder. Can I do the same with MSVC DLLs? What are the names of all required libraries? I found: msvcp140.dll, msvcp140_1.dll, msvcp140_2.dll, vcruntime140.dll and vcruntime140_1.dll. Is that all? (it worked, but will it for sure work on any computer?) – Jiří Maier May 12 '21 at 09:30
0

Just as you commented, you can use windeployqt to add Qt-related DLLs and resources. As for other required DLLs, you could use Dependencies to find them and MANUALLY copy them into your application folder, including MSVC DLLs.

PS: I know manually copy those DLLs is low efficient and fallible. This is why I ask Is there any way to search and copy all the DLL dependencies?, but I haven't found a tool smart enough to do this chore automatically. You might try those tools mentioned in the comments, like NDepend, though.

tanjor
  • 71
  • 2
  • 4