Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 610
yoni0505 Avatar asked Aug 04 '15 14:08

yoni0505


People also ask

What is the use of Visual C++ redistributable for Visual Studio 2015?

The Visual C++ Redistributable Packages install run-time components of Visual C++ libraries. These components are required to run C++ applications that are developed using Visual Studio 2015 and link dynamically to Visual C++ libraries.

How do I install Microsoft Visual C++ redistributable packages?

The Redistributable is available in the my.visualstudio.com Downloads section as Visual C++ Redistributable for Visual Studio 2019 - Version 16.7. Use the Search box to find this version. To download the files, select the platform and language you need, and then choose the Download button.

How do I add a DLL to C++ project in Visual Studio?

On the menu bar, choose File > New > Project to open the New Project dialog box. In the left pane of the New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Dynamic-Link Library (DLL).

Where are DLL files located Visual Studio?

Dll files are located in C:\Windows\System32.


2 Answers

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
like image 118
Robert Muehsig Avatar answered Oct 24 '22 12:10

Robert Muehsig


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, e.g., 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.

like image 41
CodeLurker Avatar answered Oct 24 '22 10:10

CodeLurker