Search code examples
visual-studiovisual-c++msvcrt

Visual C++ built .exe requires vcruntime140_1.dll to execute, can this requirement be removed?


I built my Visual C++ project through Visual Studio and moved the .exe to another fresh Windows 10 installation to execute. Executing the exe however requires vcruntime140_1.dll to be present to be run.

I know this can be fixed by installing C++ Redistributable but I would like to know whether it is possible to remove this requirement altogether?

Does this not get provided to Windows 10 installation when updates are run? Is it possible to target older Redistributable so that my application can run in more computers without requiring the user to download something?


Solution

  • There is no version if the retail Visual C++ runtime (vcruntime*.dll) that's part of the OS. It always has to be installed/deployed. See Microsoft Docs.

    VS 2015, VS 2017, and VS 2019 have a special case now of being "binary compatible", which means that the VS 2019 CRT is just the latest version of the same thing. That said, a few new DLLs have been added in order to both support the latest C++ conformance work -and- be binary compatible for programs built with older versions if Visual C++ (2015/2017). Again, see Microsoft Docs.

    vcruntime140_1.dll is specifically present for the new "smaller x64 exception handling" implementation covered in this blog post. You can build using the VS 2019 toolset for x64 targets but use /d2FH4- to turn off this feature and remove this specific dependency.

    You still have to have every user of your program have installed the VS 2017 version or later of the CRT.