How to tell which C++ redistributable to include in InstallShield installer? - c++

I have a C# application which uses a C++ DLL, both of which I wrote. The C++ DLL is compiled using the v120 (Visual Studio 2013) Toolset. Which redistributables do I need to include in my InstallShield installer to make this function?
There is no option for a VS2013 redistributable package, only various VS2012 packages and two for VS2015.
A few of the (unhelpfully named) options: http://imgur.com/VuDNdNt

You need to get required redistributable from installed VS2013 (C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033). Then in InstallShield you have to execute custom command (redistr_exe with parameters /q /norestart)

There is a easy way to tell this. Add the dlls which are included in the c++ redistributables and it will automatically add the merge modules instead.

Add the following (x86).prq file of Visual C++ 2013 Redistributable in Installshield install path. In mine it is (C:\Program Files (x86)\InstallShield\2015LE\SetupPrerequisites).
http://pastebin.com/Yu5DM0kJ
After that open Installshield project, in redistributables you will see Visual C++ 2013 x86. You can do the same to add x64 also.

Related

Where are the Microsoft Visual C++ 2015-2022 Redistributable (x64) packages installed?

I know visual C++ 2015-2022 is installed because:
A. I see it in Apps & Features (Microsoft Visual C++ 2015-2022 Redistributable (x64) - 14.31.31103
B. I see it in registry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64
but %VCINSTALLDIR% is not set on my path, and I cant find the dll's anywhere.
I need to be really specific with my IT dept to get this fixed. I want to add the dll to the system path but I have to find them first!
I managed to find VC_redist.x64.exe in C:\ProgramData\Package Cache\{2aaf1df0-eb13-4099-9992-962bb4e596d1} but I think that is pretty strange... it may be unrelated to the install.
Any help appreciated!
For me they are at
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC
Do note that %VCINSTALLDIR% only works in the Visual Studio Developer Command Prompt. That should be located under the Visual Studio XXXX folder in your start menu or it can be launched directly from inside visual studio. You can then enter
cd %VCINSTALLDIR%
in the terminal to get where the directory is located on your machine.
According to Github/Microsoft Visual C++ Files are in %VCINSTALLDIR%Redist\MSVC\v143 folder.
The easiest way to locate the redistributable files is by using environment variables set in a developer command prompt. In Visual Studio 2022, the redistributable files are in the %VCINSTALLDIR%Redist\MSVC\v143 folder. In the latest version of Visual Studio 2019, you'll find the redistributable files in the %VCINSTALLDIR%Redist\MSVC\v142 folder. In both Visual Studio 2017 and Visual Studio 2019, they're also found in %VCToolsRedistDir%. In Visual Studio 2015, these files can be found in %VCINSTALLDIR%redist<locale>, where is the locale of the redistributable packages.
I know visual C++ 2015-2022 is installed because:
A. I see it in Apps & Features (Microsoft Visual C++ 2015-2022
Redistributable (x64) - 14.31.31103
...
You're confusing Visual Studio (the development environment) with Microsoft Visual C++ Redistributable (a runtime support library). There isn't even such a thing as "visual C++ 2015-2022". Each version of Visual Studio has one specific year, such as Visual Studio 2017 (VS2017). The redistributable works for all Visual Studio versions between VS2015 and VS2022.
%VCINSTALLDIR% is set by the command prompts of all Visual Studio version, but the value will differ between Visual Studio variants. You can install multiple versions of Visual Studio side by side on the same computer.

Build c++ exe without dependencies

I want to build some program using C++ to work without c++ redistributable ,
I am using Toolset Visual Studio 2013 (v120) But show error msvcr120.dll missing when execute on Machine does not have microsoft visual c++ redistributable package .
Any idea to build without dependencies

ATL headers missing when using the VC++ 2015 toolchain on Visual Studio 2017

I am using Visual Studio 2017 for a C++ project (created with VS 2015). I get the following error:
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afx.h(345): fatal error C1083: Cannot open include file: 'atltrace.h': No such file or directory
How can I install the ATL/MFC headers of the VS 2015 toolchain?
Details
"Platform Toolset" setting (at "Project properties/General/Platform Toolset")
set to "Visual Studio 2015 (v140),
changing the platform toolset to "Visual Studio 2017 (v141) compiles fine.
Files on disc
The include directory for VS 2015 (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\) contains afx*.h files but no atl*.h files.
These missing files seem to belong to VC_ATL.Headers.msi ("Visual C++ Library ATL Headers Package") (which I checked on another machine with those files). I could not get the respective msi to install. (I took the msi from the other machine.) Error: "To install this product, please run Setup.exe. [...]".
The respective directory for VS 2017 (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.11.25503\atlmfc\include\) does contain those files.
Installer
"Windows Desktop Development with C++/VC++ 2015.3 v140 toolset for desktop (x86,x64)" is checked.
It seems to me that the v140 toolset is missing the ATL/MFC headers.
"Windows Desktop Development with C++/MFC and ATL support(x86 and x64)" does not seem relevant, it seems to be about the VS 2017 version.
VC++ redistributable seems irrelevant since those do not contain the header files.
There is a blog post about the Visual C++ Build Tools 2015. The build tools are also released in a standalone version without the need to install Visual Studio 2015:
The Build Tools are the same C++ tools that you get with Visual Studio 2015 but they come in a scriptable standalone installer that only lays down the tools you need to build C++ projects.
Microsoft has included ATL/MFC.
They can be downloaded from http://landinghub.visualstudio.com/visual-cpp-build-tools. Make sure to select "ATL and MFC" which is deselected by default.

MSVCP120d.dll missing

Every time I want to compile my Visual Studio project I get the message that MSVCP120d.dll is missing. Google can't help me. I already installed some redistributables but they didn't help. I also found this:
Msvcp120d.dll Debug version of C++ runtime. No redistribution
allowed.
http://msdn.microsoft.com/en-us/library/windows/hardware/dn448963(v=vs.85).aspx
From the comments, the problem was caused by using dlls that were built with Visual Studio 2013 in a project compiled with Visual Studio 2012. The reason for this was a third party library named the folders containing the dlls vc11, vc12. One has to be careful with any system that uses the compiler version (less than 4 digits) since this does not match the version of Visual Studio (except for Visual Studio 2010).
vc8 = Visual Studio 2005
vc9 = Visual Studio 2008
vc10 = Visual Studio 2010
vc11 = Visual Studio 2012
vc12 = Visual Studio 2013
vc14 = Visual Studio 2015
vc15 = Visual Studio 2017
vc16 = Visual Studio 2019
The Microsoft C++ runtime dlls use a 2 or 3 digit code also based on the compiler version not the version of Visual Studio.
MSVCP80.DLL is from Visual Studio 2005
MSVCP90.DLL is from Visual Studio 2008
MSVCP100.DLL is from Visual Studio 2010
MSVCP110.DLL is from Visual Studio 2012
MSVCP120.DLL is from Visual Studio 2013
MSVCP140.DLL is from Visual Studio 2015, 2017 and 2019
There is binary compatibility between Visual Studio 2015, 2017 and 2019.
I have found myself wasting time searching for a solution on this, and i suspect doing it again in future. So here's a note to myself and others who might find this useful.
If MSVCP120.DLL is missing, that means you have not installed Visual C++ Redistributable Packages for Visual Studio 2013 (x86 and x64). Install that, restart and you should find this file in c:\Windows\System32 .
Now if MSVCP120D.DLL is missing, this means that the application you are trying to run is built in Debug mode. As OP has mentioned, the debug version of the runtime is NOT distributable.
So what do we do?
Well, there is one option that I know of: Go to your Project's Debug configuration > C/C++ > Code Generation > Runtime Library and select Multi-threaded Debug (/MTd). This will statically link MSVCP120D.dll into your executable.
There is also a quick-fix if you just want to get something up quickly: Copy the MSVCP120D.DLL from sys32 (mine is C:\Windows\System32) folder. You may also need MSVCR120D.DLL.
Addendum to the quick fix: To reduce guesswork, you can use dependency walker. Open your application with dependency walker, and you'll see what dll files are needed.
For example, my recent application was built in Visual Studio 2015 (Windows 10 64-bit machine) and I am targeting it to a 32-bit Windows XP machine. Using dependency walker, my application (see screenshot) needs the following files:
opencv_*.dll <-- my own dll files (might also have dependency)
msvcp140d.dll <-- SysWOW64\msvcp140d.dll
kernel32.dll <-- SysWOW64\kernel32.dll
vcruntime140d.dll <-- SysWOW64\vcruntime140d.dll
ucrtbased.dll <-- SysWOW64\ucrtbased.dll
Aside from the opencv* files that I have built, I would also need to copy the system files from C:\Windows\SysWow64 (System32 for 32-bit).
You're welcome. :-)
I have the same problem with you when I implement OpenCV 2.4.11 on VS 2015.
I tried to solve this problem by three methods one by one but they didn't work:
download MSVCP120.DLL online and add it to windows path and OpenCV bin file path
install Visual C++ Redistributable Packages for Visual Studio 2013 both x86 and x86
adjust Debug mode. Go to configuration > C/C++ > Code Generation > Runtime Library and select Multi-threaded Debug (/MTd)
Finally I solved this problem by reinstalling VS2015 with selecting all the options that can be installed, it takes a lot space but it really works.
I downloaded msvcr120d.dll and msvcp120d.dll for 32-bit version and then, I put them into Debug folder of my project. It worked well. (My computer is 64-bit version)
My problem was with x64 compilations deployed to a remote testing machine. I found the x64 versions of msvp120d.dll and msvcr120d.dll in
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT
I had the same problem in Visual Studio Pro 2017: missing MSVCP120.dll file in Release mode and missing MSVCP120d.dll file in Debug mode.
I installed Visual C++ Redistributable Packages for Visual Studio 2013 and Update for Visual C++ 2013 and Visual C++ Redistributable Package as suggested here Microsoft answer this fixed the release mode.
For the debug mode what eventually worked was to copy msvcp120d.dll and msvcr120d.dll from a different computer (with Visual studio 2013) into C:\Windows\System32
Alternate approach : without installation of Redistributable package.
Check out in some github for the relevant dll, some people upload the reference dll for their application dependency.
you can download and use them in your project , I have used and run them successfully.
example : https://github.com/Emotiv/community-sdk/find/master
I was building my application on VS 2019 when this issue came up. You can copy these DLLs from this location into debug directory of your application to get going.

Including correct C++ redist with an application

I build my application in Microsoft Visual Studio 2010, and want to bundle it with vcredist, but I have to do it manually. Is there a way to automatically get vcredist corresponding to the one I used to build my application? I need only x64 support.
For instance Microsoft Visual Studio 2012 is bundled with vcredist already (it is found under Microsoft Visual Studio 11.0\VC\redist\1033). Microsoft Visual Studio 2010 has similar folder, but there are no executables or packages, only the *.dll files which is not a good option to distribute I think.
From this legal reference about what you can distribute I assume that the file you need is vs100_piaredist located in Program Files\Common Files\Merge Modules.
VS2010 also have the similar folder "/Microsoft Visual Studio 10.0/VC/redist"