简体   繁体   中英

Visual C++ 2015 redistributable DLLs for app-local deployment

Up to Visual Studio 2013 all you needed was msvcr[version].dll and msvcp[version].dll. Now they changed the DLLs with 2015. What do I need to include in order to avoid a redist installer?

EDIT:

It seems to be impossible now: http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx

"App-local deployment of the Universal CRT is not supported."

UPDATE:

The content of the link above was updated on 11 Sep 2015. Now it's possible to make app-local deployment.

This worked for me (x86 app).

Shipping all dlls from these locations with your app:

  • C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x86
  • C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\redist\\x86\\Microsoft.VC140.CRT

Myself, I needed an additional file to make this happen. Here are the directories, with one in a more generic format:

  1. Copy all the files from "C:\\Program Files\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x86" or "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x86" (or copy them from the x64 directory if it's a 64-bit app).
  2. Copy msvcp140.dll and vcruntime140.dll from: <Visual Studio 2015 Install Directory>\\Microsoft Visual Studio 14.0\\VC\\redist\\x86\\Microsoft.VC140.CRT (or copy them from the x64 directory if it's a 64-bit app).

If you're using Qt, copy these files into the directory made by windeployqt.

In general, I found that you can just do step #1, and attempt to run your app. It will tell you the first of the files it is missing, and once you have put it in your app's directory, it will tell you the next one you need. In my case, it was two. Copying similar files from my <Windows>\\System32 folder, eg, was not successful. I have found using Dependency Walker and trying to satisfy the dependencies it indicates to be unsuccessful.

This allows you to make a portable app that will run on M$ OS's as old as XP; or install for users without vcredist_x86 or vcredist_x64, who don't have admin privileges.

BTW: Step #1 is pretty official. Here it is at the MSDN blog: Introducing the Universal CRT They say to copy them all for an app to run on all M$ OS's.

In general, you can use dependency walker to find the list of dependent dlls. Regarding the visual studio runtime dlls, what you are mostly concerned about are the dlls with Visual studio specific versions in them.

As mentioned at point 6) of this article now it's possible to make local deployment of the Universal CRT. To do that you should install Windows 10 SDK and copy all the binaries from C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\u003c/code> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM