This article explains how to troubleshoot issues that can occur when the Microsoft Visual C++ Redistributable is not installed correctly by the Ranorex Studio prerequisites installer on a clean Windows 11 machine.
Symptoms
After installing Ranorex Studio on a clean Windows 11 machine, one or more of the following issues may occur:
- Ranorex cannot interact with .NET Framework WinForms applications.
- Ranorex Spy cannot recognize elements in .NET Framework applications.
- Injection into .NET Framework applications fails without displaying an error.
- Injection into .NET Core or .NET 5+ framework-dependent applications may also fail.
- No installation errors are reported during the Ranorex Studio installation.
- Running a Ranorex test executable with Remote Agent command-line arguments results in an unhandled exception.
Cause
On clean Windows 11 installations, the Ranorex Studio prerequisites installer may incorrectly determine that the Microsoft Visual C++ Redistributable is already installed and skip its installation.
Although Windows 11 includes some Visual C++ runtime components for system applications and Microsoft Store applications, these components do not replace the desktop Microsoft Visual C++ Redistributable required by Ranorex.
When the required redistributable is missing:
vcruntime140.dllis not available in the global Windows runtime locations, such asSystem32andSysWOW64.- The Microsoft Visual C++ Redistributable is not registered in Windows.
- Ranorex native injection components cannot be loaded into the target application process.
- Injection may fail silently.
Affected application types
| Target application type | Affected? | Reason |
| .NET Framework applications | Yes | These applications rely on the system-wide desktop Visual C++ runtime. |
| .NET Core / .NET 5+ framework-dependent applications | Potentially | The application may not include its own copy of vcruntime140.dll. Ranorex hook DLL dependencies are resolved through the target process DLL search path. |
| .NET Core / .NET 5+ self-contained applications | Unlikely | These applications usually include the required runtime files in the application folder. |
Verify whether the Microsoft Visual C++ Redistributable is installed
Use the following checks to confirm whether the required runtime is installed.
Check for runtime DLLs
Open PowerShell and run:
Test-Path "$env:SystemRoot\System32\vcruntime140.dll"
Test-Path "$env:SystemRoot\SysWOW64\vcruntime140.dll"Expected result when the redistributable is installed:
True
TrueIf either command returns False, the required runtime is missing.
Check the registry
Run the following commands in PowerShell:
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64"
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86"If the registry keys do not exist, the Microsoft Visual C++ Redistributable is not installed.
Check installed Visual C++ packages
Run:
$paths = @(
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
Get-ItemProperty $paths -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -match "Visual C\+\+" } |
Select-Object DisplayName, DisplayVersionIf no Microsoft Visual C++ Redistributable packages are returned, the runtime is not installed.
Solution
Install the latest supported Microsoft Visual C++ Redistributable manually.
Download and install both packages from Microsoft:
- x64 package:
https://aka.ms/vs/17/release/vc_redist.x64.exe - x86 package:
https://aka.ms/vs/17/release/vc_redist.x86.exe
Install both packages, even on a 64-bit operating system. This is required because Ranorex may interact with both 32-bit and 64-bit applications.
To install the packages silently, run:
& ".\vc_redist.x64.exe" /install /quiet /norestart
& ".\vc_redist.x86.exe" /install /quiet /norestartAlternatively, run the installers interactively by double-clicking them.
After installation, restart the computer if prompted.
Verify the fix
After installing the Microsoft Visual C++ Redistributable:
- Confirm that the following files exist:
%SystemRoot%\System32\vcruntime140.dll%SystemRoot%\SysWOW64\vcruntime140.dll - Confirm that the following registry keys are present:
HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64HKLM\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86 - Launch Ranorex Studio.
- Repeat the automation scenario.
- Verify that Ranorex Spy can identify controls in the target application and that injection succeeds.
Additional information
This issue affects systems where the desktop Microsoft Visual C++ Redistributable has never been installed.
Although Windows 11 includes certain Visual C++ runtime components for internal system use and Microsoft Store applications, these components are isolated and do not provide the desktop runtime required by Ranorex native components.
The issue can affect any .NET application in which vcruntime140.dll is not in the target process's DLL search path. Self-contained .NET Core and .NET 5+ applications are less likely to be affected because they usually include the required runtime files locally. Framework-dependent applications may be affected in the same way as .NET Framework applications.