Version of C++ runtime on build machine vs customer machine - c++

I have a Visual Studio 2012 solution containing a C++ project. To be able to run the compiled application on customer machines I have included the latest C++ redistributable as a prerequisite in the installation program.
The C++ distributable that I included is the latest from Microsoft - version 11.0.61030.0.
When I search for msvcr110.dll on the build machine I see the file in multiple locations, but all files have the version 11.00.51106.1.
As I can see I have an older version on the build machine compared to the version I ship to the customers. Is this a problem? How do I update my build environment to the latest version?

If you are building in external dependencies, then you should make certain that you have the same version installed on your build machine that you do on your customers machines. There can be bugs or inefficiencies that are corrected in latter versions, but even worse it's very possible that you could see side-by-side issues: http://www.codeproject.com/Articles/43681/Side-by-Side-Configuration-Incorrect
Most of the developers using assemblies in their application may have faced this issue. While starting an application, we may get an error “This application has failed to start because its side by side configuration is incorrect”.
Anyway to get the latest redistributable for Visual Studio 2012 you can go here: http://www.microsoft.com/en-us/download/details.aspx?id=30679

Related

How can I avoid an error loading Microsoft.VisualStudio.Threading in Visual Studio 2017

I have made a log of updates to my Visual Studio package in a version which only targets Visual Studio 2019. One change that I started using the NuGet package Microsoft.VisualStudio.SDK, version 16.0.202 and removed a lot of separate references to DLLs.
Now I have ported the latest version of my package back to Visual Studio 2017 and downgraded several NuGet packages (for example Microsoft.CodeAnalysis) to older versions.
I have downgraded Microsoft.VisualStudio.SDK to version 15.9.3, which is the oldest available version.
Initially, this seemed to work fine on several systems. However, on one system my package is not loaded and a message is written to the Activity Log, something like
Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=15.8.0.0
(The message is actually in German, but that is the equivalent message in English.)
I can see two possible solutions:
[1]
Throw out Microsoft.VisualStudio.SDK and go back to referencing lots of separate DLLs.
I would prefer not to do that.
[2]
Increase the minimum required version number of Visual Studio.
Using Microsoft.VisualStudio.SDK version 15.9.3, would I have to set the minimum version of Visual Studio to 15.9.3?
(That would be restrictive, but better than a package that doesn't load.)
Increasing the minimum required VS version is necessary.
1.For packageReference format, if one project references the Microsoft.VisualStudio.SDK package, this project actually depends on the nuget packages the Microsoft.VisualStudio.SDK depends on. We call them nuget package dependencies.
2.And for Microsoft.VisualStudio.SDK package with version 15.9.3, it also depends on Microsoft.VisualStudio.Threading package.(At least 15.8.132, by default nuget will download the 15.8.132)
So your extension project actually depends on Microsoft.VisualStudio.Threading.dll 15.8.0.0.
3.And for Microsoft.VisualStudio.Threading.dll under path C:\Program Files (x86)\Microsoft Visual Studio\2017\xxx\Common7\IDE\PrivateAssemblies, for VS2017-15.9.16, its version is 15.8.0.0. For VS2017-15.0.0, its version is 15.0.0.0.
Then if I have a VS2017-15.6.x, I could have the Microsoft.VisualStudio.Threading.dll whose version in this scope [15.0.0.0,15.8.0.0). If we install the extension which depends on that assembly with version 15.8.0.0 into an older vs version than 15.8.x, we'll meet similar issue.
I can see two possible solutions
I think your user could be in a similar situation with an older vs version. And if he updates vs to latest vs2017-15.9.17, this issue will go away. And yes, if you using Microsoft.VisualStudio.SDK version 15.9.3, please set minimum version of Visual Studio to 15.9.3.
You can check the dependencies there:
This package also depends on packages with 15.9.2x, even 15.9.3 versions. To avoid meeting similar issues like Could not load file or assembly 'xxx, Version=15.9.0.0, increasing the minimal requirement to make VS version consistent with the VS SDK version is recommended. (In VS with version 15.9.0, we may not meet issue like can't load xxx with 15.8.0.0, but we may encounter issue like can't load xxx with 15.9.2.0)
Hope it helps :)
Using VS 2022
I have mange to solve this issue by install/update those nuggets
Image showing the needed nuggets

remove msvc dlls dependency to run qt application

How to remove msvc dlls (example: msvcr100.dll) dependency to run qt appliation?
I've developed a qt application which runs just fine in dveloper machine but unable to run on any other machine gives error message "program can't start because MSVCR100.dll is missing from your computer". I can solve this error by copying that file in the application folder but I dont want to copy, instead I want to link statically or some other way to remove that dependency.
Thanks in advance
The issue is that you are probably trying to run an application on a machine which has a different Visual Studio (MSVC) version installed than the version that was used for building your application itself.
Generally, the correct solution is to install the corresponding Visual Studio redistributable package on the target machine. It is not a "workaround" or "hack" because if you wish to use an application built with different runtime libraries, etc, then it is expected. Here you can read a bit more about it:
Redistributing Visual C++ Files
Yes, it is a bit unfortunate, and apparently MS has not managed to make it the most ideal, but after all, it is simple enough to circumvent. Note that the target machine would not only have issues with your application, but in general with any distributed in a similar fashion.
The other way to solve the issue is to build the application with the same environment that is installed on the target machine, but this can easily go haywire if you need to supply the application to several machines with versatile setup. Now, I would say this is the "hackish" approach.
You will need to grab the redistributable for this particular problem from here:
Microsoft Visual C++ 2010 Redistributable Package (x86)
Microsoft Visual C++ 2010 Redistributable Package (x64)
Even if you went down for statically hacking this around somehow, you would need to deal with nasty consequences when using your application with DLLs and static libraries, etc.
As far as I know, you can't link statically to Visual Studio Redistributable. Any application built with Visual Studio Compiler needs the corresponding msvcXXX.dll to run. Installers containing all dll for each specific version of MSVC are available here: http://search.microsoft.com/en-us/DownloadResults.aspx?q=redistributable
If you want avoid errors for your users when you distribute your application, you have some solution. A commonly used is to install the right redistributable package before installing your application on the user machine. Often used tools (NSIS, Inno Setup, etc.) have options to run other executable in the process. And each Microsoft redist package can be run silently (without any window display to user).
Note: This problem is absolutely not related to qt. It comes directly from the compiler you choose.

MSVCP100.dll not found error even when it is installed

i get the following error when i try to run an exe on a x64 machine that was build for x86 CPU using the MC++ compiler (vs2010) on a x86 machine:
i already have visual studio 2012 (along with Visual C++ 2012 Update 4 redistributable- both x86 and x64) installed on this second (x64) machine.
A quick search tells me the "MSVCR100.dll" is already present in "C:\Windows\System32".
i tried to install the Microsoft Visual C++ 2010 Redistributable but it exited with an error telling me that a superior version is already installed.
Please guide me what i am doing wrong. :)
Firstly, in 64-bit versions of Windows, 32-bit system executables and application extension files (aka DLLs) are placed in %systemroot%\SysWOW64 instead of %systemroot%\System32 (which, somewhat counterintuitively, contains 64-bit versions in a 64-bit Windows). So the SysWOW64 folder has to be checked for the x86/32-bit MSVC(++) DLLs.
Secondly, though installation of the corresponding visual studio version on the target machine or having accompanied the distributed program with the required C(++) DLLs should, theoretically, solve the problem, it's not necessary. It's sufficient to have the corresponding MSVC++ redistributable package installed (i.e. e.g. Microsoft Visual C++ 2010 x86 redistributable package in this particular case).
Notes:
The aforementioned info are theoretically correct but damaged Windows installations or ... may not conform.
Including the C++ DLLs with the distributed program is acceptable (and possibly a conservative but correct decision) but installing a Visual Studio version solely to be able to use the DLLs in question definitely isn't.
As a side note, C++ redistributable packages don't install the debug versions of the DLLs so installation of or access to a corresponding Visual Studio version is necessary for running debug-compiled applications.
Your application needs the dll for VS2010. you should place MSVCR100.dll and MSVCP100.dll from your x86 machine beside your exe. You can also install VS2010 alongside your current VS2012. then you should also install the Service Pack1 for VS2010 to work properly. After installing VS2010 you have access to both mentioned dlls and also you probably don't need to copy them to your exe directory.

Visual Studio 2012 Project targeting Windows XP using MFC

I have recently acquired source code from a VS2005 project that uses the MFC library. Firstly I upgraded the project to VS2012 and I can now successfully build and run the software on Windows 8. Next, I wanted to deploy the software on a Windows XP machine.
I have set the Platform Toolset to build to Windows XP (using the v110_xp option) and I have installed the 'Visual C++ Redistributable for Visual Studio 2012 Update 1' on the target machine. When I run the software, nothing appears to happen. Via some logging functions I can determine that a call to LoadFrame(IDR_MAINFRAME) causes an exception in kernel32.dll. I can't debug any further in to LoadFrame as remote debugging on Windows XP is not available in VS2012.
Any ideas what may be going wrong? Is the Visual C++ Redistributable package the correct version to be installing on the target machine? What should I be trying next?
UPDATE
My project is already set up to use the 7.1 SDK and has minimum required version set to 5.01 in linker options.
If I use InstallShield to generate an installer and include the MFC, CRT and ATL redistributables, the installer works and my program now runs on Windows XP. My understanding of the redistributables is that they simply copy the relevant dll's in to the system32 folder (or equivalent)? Is that correct?
However, if I simply copy the files over, run the vsredist_x86.exe or use Inno Setup to install the software & dll's, my program no longer works.
I believe you have read this blog. In summary, you need to use the 7.1 SDK, and you need to set minimum required version to 5.01 in linker options.
Using the working InstallShield project and the not-working Inno project I was able to determine that the real culprit here was an unregistered msxml4.dll. The error I was receiving gave no real clue to this outcome but I got there eventually...
regsvr32 msxml4.dll

Can't Compile Solution in Debug Mode Because MSVCR100D.dll is Missing

I am running Microsoft Visual Studio Express 2012 for Windows Desktop on a 64 bit machine with windows 8.
I create a completely new Win32 Console Application (in C++) and accept the default options. I then build and run the solution in both debug and release modes and it works all find and dandy. Next I configure the include and library directories for the dynamic SFML library. I link to the debug and release .lib files and put the debug and release .dll files in the proper directories. I then add some simple code which uses the library, build and run the application in debug mode and I get this error: "The program can't start because MSVCR100D.dll is missing from your computer. Try reinstalling the program to fix this problem." If I build and run the application in release mode it works with no errors. (And yes I have the redistributables installed 32 and 64 bit.) Now from what I understand and according to this thread that .dll file is for debugging only and is not included in the redistributable package (which would explain why it doesn't work in debug mode). The answer says that developers have it installed with visual studio by default. This is obviously not the case as evidence from the error and I've reinstalled visual studio and restarted my computer twice now.
In conclusion, how do I simply compile my solution in debug mode without getting this error?
I'm afraid someone will mark this as a duplicate so here we go:
LINK - "...you appear to be linking to the debug version of the runtime, it is not normal to distribute apps linked against the debug version of the runtime."
Doesn't pertain to me because I'm not distributing this app, just trying to run it in debug mode.
LINK - "I compiled my program using Microsoft visual c++ 2010 Express Edition and tried to run it on another machine that did not have the same compiler."
This person get's the error when he runs what hes compiled on a different computer, not when actually compiling the application.
LINK - "If you get this error for your release build..."
I dont.
LINK - "You can compile your project in "Release"..."
My project is not ready to be released therefore I should compile my project in debug mode.
MSVCR100D.dll is the dll for Visual Studio 10, so somewhere something is depending on it (the SFML dlls?). Whatever you compile (in debug mode) with Visual Studio 2012 will require MSVCR110D.dll, which you should have available on your machine as part of the installation.
I suggest you build SFML yourself on your own version of Visual Studio, it's pretty easy. In fact, the binaries available on the site as part of the SFML 2.0 RC are rather old and you'll do yourself a huge favor by building from the latest sources, as a lot of fixes and improvement were applied in the meantime.
(Also, definitely use 2.0 instead of 1.6. The site is rather misleading, but on the SFML forums virtually everyone will recommend you use the last version)
This message generally states that the dll is referred to directly or indirectly in your application and is missing.
The 'D' at the end show us this is the Debug version of the file, this is DLL file is provided with the Visual Studio 2010 installation. So the MSVCR100D.dll would be provided with the installation of Visual Studio 2010.
Of course, you could be missing other versions 2008 (MSVCR90D) 2010 (MSVCR100D) 2012 (MSVCR110D) or the 2013 (MSVCR120D), each dll is provided according to the Visual Studio version.
There are a few ways to solve this:
Check to be sure that you're compiling all the components of your
project in Release mode. If this does not solve the issue continue
to the next steps.
You could solve this locally by installing Visual Studio 2010 on your
machine. This is not what I would recommend, but it would surely
overcome the issue
You could also download the file from this third party website and
copy it to your projects bin:
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d
This option is the LEAST recommended option.
Run dependency Walker and see what file depends on the MSVCR100D.dll
and the try and fix that file in order to break your dependency. You can download depends here: http://www.dependencywalker.com/
Check to be sure that you're project is linking the correct version of
the CRT and any other libraries you may be using (e.g., MFC, ATL,
etc.)
Note: Installing the redistributables alone will NOT solve this problem, since the redistributables only contain the release version of the file MSVCR100.dll (notice no 'D')
MSVCR100D is part of the 2010 Visual Studio package - indicating that some components of your system are compiled with the older version of Visual Studio, so you will need to install the Visual Studio 2010 version - you can probably still develop with the 2012 version, just as long as [parts of] the 2010 is on the machine.
Or you need to recompile some components that your application depends on to use the 2012 (msvcr110d) libraries - if you have all the source code, that would be my preferrred method.