9

Short Version: Is it possible to run an executable compiled with Visual Studio 2015 without installing the Visual C++ Redistributable Packages, and instead copying the runtime DLLs into the same folder as your executable?

Long Version...

Since the mid 1990s I have written small programs using Visual C++ and then later Visual Studio. Up until Visual Studio 2013 I have always been able to run these programs on any Windows host as long I put msvcpXXX.dll and msvcrXXX.dll in the same directory. I have never needed to install the Visual C++ Redistributable Packages.

Now with Visual Studio 2015 this appears to no longer work. First there is no msvcrXXX.dll. So I copied msvcp140.dll and three other DLLs I found in the Visual Studio folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT (concrt140.dll, vccorlib140.dll, vcruntime140.dll). Still doesn't run.

Looking at the depends.exe makes me think there are a lot of dependencies that are not resolved in these DLLs. I confess I got a little overwhelmed and didn't keep digging on my own to figure out every DLL I need to have to satisfy the dependencies. But it started feeling very hacky, as many of them were installed under C:\Windows and not present in my Visual Studio redistributable folders.

Anyway, can anyone help?

John Fitzpatrick
  • 4,207
  • 7
  • 48
  • 71
  • 2
    What about [this question](http://stackoverflow.com/q/31811597/3962537)? Or perhaps link statically to the runtime? Personally I just use the redistributable, it's a lot less hassle. – Dan Mašek May 27 '16 at 15:47
  • 1
    Static linking worked on Windows 10 and 2012 hosts. But on my Windows 2008 hosts it wouldn't start due to api-ms-win-crt-runtime-l1-1-0.dll missing. It looks like the question you linked to may answer this. – John Fitzpatrick May 27 '16 at 15:51

1 Answers1

5

This was surprisingly not closed as a duplicate. And I hate leaving open questions unanswered. So I'll answer it myself by saying that codestation's comment links to this question which links to this article which describes how to do this in the section that starts with bold red text.

You shouldn't upvote this. Upvote the answer in the linked question.

Community
  • 1
  • 1
John Fitzpatrick
  • 4,207
  • 7
  • 48
  • 71