41

I've built a C++ application using Microsoft Visual Studio 2015 Community Edition. I'm using Advanced Installer to make sure that the Visual C++ Redistributable for Visual Studio 2015 is a prerequisite.

However, the redistributable's installer isn't perfect. Some of my users have reported that the redistributable installer hangs, or it fails to install when it says it does, and then users get the "This program can't start because MSVCP140.dll is missing from your computer" error.

According to Microsoft, I can now package the redistributable DLLs along with my application, though they don't recommend it (1, 2):

To deploy redistributable Visual C++ files, you can use the Visual C++ Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or VCRedist_arm.exe) that are included in Visual Studio. ... It's also possible to directly install redistributable Visual C++ DLLs in the application local folder, which is the folder that contains your executable application file. For servicing reasons, we do not recommend that you use this installation location.

There are 4 files in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT. Does that mean I just need to copy them to my application's directory during the install process?

  • MyApp.exe
  • concrt140.dll
  • msvcp140.dll
  • vccorlib140.dll
  • vcruntime140.dll

Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?

3
  • 1
    Hmya, the redist installer is like a canary in the coal mine. When the target machine is too gassed up then it is the one that keels over. Of course they'll hassle you about it but it is not like they won't when you use local deployment and it is your installer or main program that keels over. That does not put you ahead, you at least have plausible deniability when it is a Microsoft program that can't complete :) Tell them to temporarily disable their anti-malware, all you can reasonably do. Jan 30, 2016 at 9:44
  • The path is Microsoft Visual Studio\2022\Community\VC\Redist\MSVC now
    – user15719632
    Sep 8, 2022 at 10:23
  • 1
    The licensing link is dead. The new URI is learn.microsoft.com/en-us/cpp/windows/…, but I'd recommend separately linking (also) the fragment about bundling individual DLLs.
    – Sz.
    Feb 20, 2023 at 12:16

3 Answers 3

26

There are 4 files in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT. Does that mean I just need to copy them to my application's directory during the install process?

Yes, and the paragraph you quoted means just that.

Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?

Technically, that's OK to do. If you want to be pedantic about it, you may include a note in the readme or help/about to the effect that VC++ 2015 redistributables provided in "local deployment" mode as explicitly allowed by Microsoft's Deployment in Visual C++ (with more links to the file lists and licenses at Redistributing Visual C++ Files).

As to why more people don't do it, I'd guess that (among those who care at all):

  • for a single module app like MyApp.exe it's easier to build it with everything linked statically as to eliminate external dependencies to begin with;
  • not including those files saves 1+ MB from the distribution (presumably download) size;
  • running with private copies of the runtime ("local deployment") shifts the responsibility of updates to the maintainer, so that in case of a critical/security fix the package would have to be reissued timely - as opposed to "central deployment" where it would likely be delivered via Windows Update, with both the good and bad that may bring.
4
  • Years later superuser.com/questions/1163409/… Sep 4, 2020 at 10:54
  • @displayname Right, "missing DLLs" errors like that is what local deployment is meant to resolve, without requiring admin rights and elevation to install the respective runtimes system-side.
    – dxiv
    Sep 4, 2020 at 15:39
  • 1
    Updated link Microsoft official link: Redistributing Visual C++ Files: Redistributable files and licensing. It includes links to the actual license as well as the list of files allowed to be redistributed.
    – wkschwartz
    Jan 21, 2021 at 5:36
  • @wkschwartz Thanks. Updated the original (stale) link and added the one you pointed out.
    – dxiv
    Jan 21, 2021 at 6:33
4

If you have problems with the prerequisites installer you also have the option to install the redistributables as merge modules. As the same MSDN article mentions:

Another option is to use redistributable merge modules (.msm files), which can be found in Program Files [(x86)]\Common Files\Merge Modules.

Using merge modules it is a much cleaner option than manually adding the files. The files can be deleted accidentally by another colleague which does not know why they are there, or one of them might not get installed, etc...

All editions of Advanced Installer have support to include merge modules, including the free edition.

2

Visual Studio Community 2022

enter image description here

  1. Go to: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\x64\Microsoft.VC143.CRT

  2. Copy the contents into the search path of your project

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.