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

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:
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).
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.

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.

Related

Can I bundle the Visual Studio 2015 C++ Redistributable DLL's with my application?

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?
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.
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.
how to add a merge module into an Advanced Installer project/package
Visual Studio Community 2022
Go to: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\x64\Microsoft.VC143.CRT
Copy the contents into the search path of your project

MSVC 2015 Universal CRT for app-local deployment

It was announced that the Universal CRT would be a re-distributable DLL such that app-local deployment would still be possible.
I have installed the Visual Studio 2015 Express Edition and I was looking for ucrtbase.dll in the SDK directories, but I could not find anything. The directory that I looked into was "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10", but that only has the debug version of the CRT under "Microsoft.UniversalCRT.Debug".
I prefer not to copy any DLLs from my system, I always only package files from the "Redist" directories. So for instance (like with the previous versions of MSVC), I re-distribute files from "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT" with x86 builds of my app.
Is there a package that I can download that contains the ucrtbase.dll, or perhaps a Visual Studio or SDK update?
Also I am not sure at this point whether just the ucrtbase.dll will be sufficient, as the applications seem to be linked to the stub DLLs api-*.dll, and I'm not sure whether those need to be re-distributed as well.
This blog post under Distributing Software that uses the Universal CRT section describes all the cases in detail, with a big red update notice concerning app-local deployment:
Updated September 11, 2015: App-local deployment of the Universal CRT is supported. To obtain the binaries for app-local deployment, install the Windows Software Development Kit (SDK) for Windows 10. The binaries will be installed to C:\Program Files (x86)\Windows Kits\10\Redist\ucrt. You will need to copy all of the DLLs with your app (note that the set of DLLs are necessary is different on different versions of Windows, so you must include all of the DLLs in order for your program to run on all supported versions of Windows)
You can download UCRT from Microsoft Donwload Center. UCRT is part of OS now, for Vista SP2/7/8/8.1 it is distributed by Update Center.

Fresh installation of VS 2012 will not build default console application: Missing SDKDDKVer.h (and stdio.h / CRT)

I have been using the trial version of VS 2012 Professional for about 1 month on my Windows 7 64-bit machine.
Today, I noticed that the Platform Toolset option (project properties) was set for Visual Studio 2010 (v100), which seemed odd, because I am running VS 2012. Changing the "Platform Toolset" to VS 2012 resulted in the error noted in the title of this question:
Cannot open include file: 'SDKDDKVer.h': No such file or directory
... while building stdafx.cpp (the error itself occurs in the file targetver.h).
A forum discussion I was browsing earlier hinted that the presence of VS 2010 during a VS 2012 install might have caused the problem. (I do not have links to those posts currently on hand.)
Because I have recently purchased VS 2012 Professional, I uninstalled the trial version of VS 2012, and then reinstalled a paid version VS 2012 (Professional) from a fresh download from the MSDN website. All told, the uninstall/reinstall required 2 hours or so.
During the reinstallation of VS 2012, I paid very close attention to all possible options, to see if any option might conceivably have caused the VS 2012 installer to "skip" the VS 2012 header files or other VS 2012 components, and use VS 2010 components instead. I could find no such option.
Reinstallation of VS 2012 was successful.
I created a new console project in a new workspace (note that my "recent projects list" still showed my recent VS 2012 projects, despite the uninstall/reinstall). The project settings for the new console project showed that the correct toolset was being used - Platform Toolset = Visual Studio 2012 (v110).
Unfortunately, building the out-of-the-box VS 2012 console application (including the precompiled header option, but no other option in the Create Project Wizard), results in exactly the same error:
Cannot open include file: 'SDKDDKVer.h': No such file or directory
What should I do?
.
ADDENDUM: Note for future readers; after changing path settings (see comments beneath answer, below) so that VS 2012 finds SDKDDKVer.h, it nonetheless fails to find stdio.h, a more serious problem because the VC11 version of stdio.h (as well as all the VC11 CRT headers) is not available on the machine anywhere.
Unfortunately, Microsoft has still not resolved these major bugs in their VS 2012 installation process. The only way I found to get a working VS 2012 installation including all VC11 CRT files is to:
Wipe your system completely clean of all MS products (this may be overkill, but I had to at least uninstall VS 2010 in addition to uninstalling VS 2012)
Remove the registry keys noted in the comments to the answer below (to be safe)
Delete residual directories (to be safe)
Restart (to be safe)
Install VS 2012 from scratch FROM THE .ISO, not the installer (assuming the installation files are downloaded from the MSDN site) (use a program like Power2Go to mount the .iso)
THEN, be absolutely sure to install VS 2012 Service Pack 1 (through "Windows Update" control panel) (without doing this step, the VC11 CRT headers are STILL not installed anywhere on the machine)
And finally, map the Windows SDK library directories as described in [this link](Link now points to a scam site, removed) (without doing this latter step, the linker fails to finde the path to the Windows kernel library)
... THEN there is a working installation of VS 2012.
Thanks alot, Microsoft.
After I set up Visual Studio 2013, I had same sdk error for a simple C++ code. I solve same problem with below steps:
Select Project Properties>Configuration>VC++ Directories>Include Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
Select Project Properties>Configuration>VC++ Directories>Library Directories and add that: c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib
After that configuration I had problem about rc.exe link error. For this problem one more thing is needed:
copy RC.exe and RcDll.dll files from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin and past them to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
After all those configuration steps, you can build a simple "Hello World!" example and run if you are lucky.
from MSDN forum:
Looking at the Include Directories for this project, I see the following
$(WindowsSdkDir)include
"WindowsSdkDir" is defined to be "C:\Program Files (x86)\Windows Kits\8.0\"
Unfortunately, the folder
"C:\Program Files (x86)\Windows Kits\8.0\Include\" doesn't actually
have any header files in it. Instead it contains three sub-folders.
One of these is the folder called "shared" which happens to contain
the "SDKDDKVer.h" file shown in the error message.
If this is your situation, replace $(WindowsSdkDir)include by the three folder names (at least $(WindowsSdkDir)include\shared) in your include path in your project properties under VC++ Directories.
To add this path permanently to VS2012, you'll need to make changes to the Microsoft.Cpp.Win32.user.props file under the C:\Users\xxx\AppData\Local\Microsoft\MSBuild\v4.0 folder (where xxx is your user name).
I had this problem with VS2013. Turns out when I separately installed Windows SDK 8.1 first, then Visual Studio 2013, it fixed the problem.
I should also note that I was installing this on a Windows 7 w SP 1 VM and at no point during the installation did it have a connection to the internet (I have read elsewhere some folks think an internet connection during install will fix the problem, but I was personally unable to verify that, and now that I have it working I'm not going to backtrack and test it).

Can't get visual studio C++ include file 'excpt.h' to get installed

I'm trying to compile a visual studio C++ project and I can't get anywhere because of the compiler reporting "Cannot open include file: 'excpt.h': No such file or directory". The problem has been reported numerous times on the Internet but I can't find any help regarding my particular situation. The problem is not that the include path of the project are not correctly setup, the problem is that this include file (and probably a bunch of other files) are just missing from my computer. There is no such file on my hard drive. So I tried installing Windows SDK 7.1. The file is not inside the installed SDK (although it should be). I tried repairing the install, uninstall it, reinstall it... all numerous time. I also try to install, repair, uninstall, reinstall Visual Studio 2010 professional numerous time, with and without the Windows SDK installed. I even tried uninstalling the professional version to install the express VC++... nothing seems to work, no 'excpt.h' never get installed on my computer. I am clueless... someone has a hint of a solution? I'm on Windows 7.
As supplementary information, note that 'excpt.h' is included in by "windows.h". Also, the "excpt.h" file is normally installed with the Windows SDK under a path like "c:\program files (x86)\microsoft sdks\windows\v7.1\include\" and with Visual Studio under a path like "C:\Program Files\Microsoft Visual Studio 10.0\VC\include\".
EDIT: If it might help, I might add that the folder C:\Program Files\Microsoft Visual Studio 10.0\VC\include related my Visual Studio install has only two files... which is certainly not normal!!! However, I can't find any ways to get the installer to install all the .h files that should appear in this repertory.
See if you have it at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\excpt.h Check to be sure that the system include-paths are correct in Visual Studio. If all else fails, uninstall everything, all SDK's, etc., and re-install Visual C++.
Third party search programs do a better job than the Windows one for finding things. Try Agent Ransack. It's free.
For those who have the same problem, here is the solution I found after about 10h of install/uninstall/cleaning cycles... I've uninstalled completely visual studio using this. After that, using the control panel, I've uninstalled the Windows SDK and everything that can be associated with it or with visual studio (e.g. .NET framework). Then, I've removed all the left overs by manually deleting the visual studio and the Windows SDK folders located in C:/Program files. Finally, I deleted all the entries related to the Windows SDK or to Visual Studio in the registry (they are located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft). Then, I reinstalled Visual Studio... and it was finally working correctly. I should add that I restarted and cleaned the registry using CCleaner after any install or uninstall step.
I had this problem with a project that had been updated to VS2017 from VS2015.
This was a header included via windows.h. I knew this header should have no problems as I had other projects created directly in VS2017 that used windows.h.
Another symptom was that the intellisense was highlighting includes of standard headers (e.g string, vector etc), although these were not generating compile errors.
The fix for me was similar to VS 2010 Cannot open source file “string”.
Initially, I retargeted the project, hoping this would help (right-click the project, select retarget projects), but this did not in itself cure the problem.
I then took a working project and copied the include directories from project properties->Configuration Properties->VC++ Directories and used these to replace the same property for my broken project. This fixed the problem.
Initially, the value for this property was
$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);
The replacement value was
$(VC_IncludePath);$(WindowsSDK_IncludePath);
I had the same problem, and tried the answer given by OP, but it did not work. However, copying the contents of C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC (specifically bin, lib, and include) from a machine that did work to this machine worked.
It seems the Visual Studio 2012 installer is buggy when it comes to installing into a different drive letter than C:. I have installed the VS2012 into the D: drive and got the same error. I found that for some unknown reason the installer put some of the files into the correct location at:
D:\Program Files (x86)\Microsoft Visual Studio 11.0
but the remaining files were at
C:\Program Files (x86)\Microsoft Visual Studio 11.0
so I have moved the files from the C: into the D: location and it fixed the problem.
Some situation cause such problem. If you have uninstalled vs2010. you lost platform C++ binaries for .net framework 4 forever. You have to delete all of VS 2010 2012 2013, clean system up and its accompany components and reinstall them from scratch.
Or you can download this package. Include them in your project that may solve your problem properly.
one simeple way,just copy vc directory(C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC) from other computer
Fixing your Visual Studio installation is a good idea, but you don't necessarily need to re-install the same old version of VS. I uninstalled VS 2015, then modified my VS 2017 installation to add the VC++ v140 build tools, and now my project builds.

Visual Studio 2005 Deployment

I have created an application on Windows XP, Visual Studio 2005, C++.
I want to run the application using its .EXE file on a different computer but it crashes.
I think it maybe related to some .dll missing files.
Am I in the right direction?
If so, how do I know which files are missing?
Is there a build option in the Visual to copy all the requested .dll to a specific place?
Thanks,
Asaf
The most likely answer is that the other computer is missing the Microsoft VC++ redistributable files. You can download the VS2005 (or VS2005 SP1) file from Microsoft. It's name is vcredist_x86.exe (assuming standard x86 build). Just run it on the target PC and then retry your app.
If you assume it is a missing DLL you can also use the Dependency Walker
But I agree to Joel that most probably it will be the redist package that is missing or if you tried to use a debug version you might need the non redist package.
But you don't have to download them. They should be part of your VS installation. Somewhere in the VC/redist folder.
I use dependency walker to watch which dlls are missing for my program.
There's an in depth discussion of the options and steps required to get Visual Studio 2005 C++ Applications to run on machines which don't have Visual Studio installed here.
It includes detailed instruction for Visual C++ Express users too.