windowsinno-setupsystem32

Inno Setup "Source file C:\Windows\System32\vcruntime140_1.dll does not exist" error


I'm trying to install some Visual Studio dlls on the guest machine with Inno Setup. Here is the [Files] section of my script:

[Files]
Source: ...
...
Source: "C:\Windows\System32\msvcp140.dll"; DestDir: "{app}"
Source: "C:\Windows\System32\vcruntime140.dll"; DestDir: "{app}"
Source: "C:\Windows\System32\vcruntime140_1.dll"; DestDir: "{app}"

It gives me an error in the last line, saying that it can't find the source file, although it is there. Does it have something to do with the _ having a special effect with Inno Setup?

The file in System32 folder


Solution

  • On my 64-bit system, the vcruntime140_1.dll is in the real 64-bit C:\Windows\System32. Inno Setup compiler is a 32-bit application. Due to WOW64 file system redirection, when a 32-bit application tries to access the C:\Windows\System32, it gets redirected to C:\Windows\SysWOW64, where 32-bit system files are. There's no vcruntime140_1.dll.

    This also shows you the weakness of your approach, as others have commented. You likely didn't even realize that there are multiple versions of the DLL. If you use the official Visual C++ Redistributable installer, it will take care of installing the right versions to the right locations. While you would not. You should not mess with System32 folder.

    Some examples: