Use this article if Ranorex Studio cannot load Microsoft Build Engine (MSBuild) and displays a System.IO.FileLoadException.
Symptoms
Ranorex Studio displays the following error when loading or building a solution:
System.IO.FileLoadException: Could not load file or assembly
'Microsoft.Build, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.The solution may not load or build successfully.
Cause
The MSBuild version configured in Ranorex Studio does not match a compatible MSBuild version installed on the machine.
For example, this error can occur when Ranorex Studio is configured to use MSBuild 18, but only MSBuild 16 is installed.
Confirm the MSBuild version mismatch
- Close Ranorex Studio.
-
Open the following configuration files:
C:\Program Files (x86)\Ranorex\Studio\Bin\RanorexStudio.exe.configC:\Program Files (x86)\Ranorex\Studio\Bin\x64\RanorexStudio.exe.config -
In both files, locate the MSBuildVersion setting:
<add key="MSBuildVersion" value="18" /> - Confirm that both configuration files contain the same value.
- Check which MSBuild major version is installed on the machine.
-
Compare the configured and installed versions with the following compatibility information: Microsoft MSBuild Update May Affect Ranorex Studio.
Solution
Use one of the following options.
Option 1: Install the configured MSBuild version
Install a compatible Visual Studio Build Tools version that provides the MSBuild major version specified in the configuration files.
For example, if the configuration contains:
<add key="MSBuildVersion" value="18" />Install Visual Studio Build Tools 2026 with MSBuild 18.3.3 or earlier.
After installation, restart Ranorex Studio.
Option 2: Configure Ranorex Studio to use an installed version
If another compatible MSBuild version is already installed, configure Ranorex Studio to use that version.
- Close Ranorex Studio.
-
Open both configuration files:
C:\Program Files (x86)\Ranorex\Studio\Bin\RanorexStudio.exe.configC:\Program Files (x86)\Ranorex\Studio\Bin\x64\RanorexStudio.exe.config - In both files, locate the MSBuildVersion setting.
-
Change the value to the compatible MSBuild major version installed on the machine. For example, to use MSBuild 16:
<add key="MSBuildVersion" value="16" /> - Save both configuration files.
- Restart Ranorex Studio.
Verify the resolution
Open the affected solution and rebuild it. The solution should load and build without displaying the System.IO.FileLoadException.
If the error continues, confirm that:
- Both configuration files contain the same
MSBuildVersionvalue. - The configured MSBuild major version is installed.
- The installed MSBuild release is compatible with your Ranorex Studio version.