# Building UE 4.27 with VS 2026

**URL:** <https://forums.unrealengine.com/t/building-ue-4-27-with-vs-2026/2700816>\
**Category:** C++\
**Tags:** automationtool, rider, error-building, compilation-error, unreal-engine, building, build-failed\
**Created:** [February 19, 2026, 5:09am UTC](https://forums.unrealengine.com/t/building-ue-4-27-with-vs-2026/2700816 "2026-02-19T05:09:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [February 19, 2026, 5:09am UTC](https://forums.unrealengine.com/t/building-ue-4-27-with-vs-2026/2700816/1 "2026-02-19T05:09:30Z")

</div>

If, like me, you refuse to install an older VS when you have to work on older projects, you might get a bunch of errors from the AutomationTool if you happen to have an MSBuild.exe under this path:

```txt
C:\Windows\Microsoft.NET\Framework64\v4.0.xxxx

```

If you don’t, I don’t even know what sort of errors it will throw. But the issue when it finds that old MSBuild is that it fails to recognize the newer C# features in the automation scripts.

UE 4.27 is prepared to recognize installations of VS up to 2022. But the code has a fallback, where it caches the path of newer installations as if it was a 2022 one. The problem is that the function `TryGetMsBuildPath` is only looking for 2019 and older. The fix is to have it recognize 2022, and it will work with whatever path was found, even for newer installations.

Modify the function `TryGetMsBuildPath` inside `UEBuildWindows.cs` by duplicating the existing code for 2019 and replacing occurrences of 2019 with 2022:

```cs
public static bool TryGetMsBuildPath(out FileReference OutLocation)
{
	// BEGIN CUSTOM - Get the Visual Studio 2022 install directory
	List<DirectoryReference> InstallDirs2022 = WindowsPlatform.FindVisualStudioInstallations(WindowsCompiler.VisualStudio2022).ConvertAll(x => x.BaseDir);
	foreach (DirectoryReference InstallDir in InstallDirs2022)
	{
		FileReference MsBuildLocation = FileReference.Combine(InstallDir, "MSBuild", "Current", "Bin", "MSBuild.exe");
		if (FileReference.Exists(MsBuildLocation))
		{
			OutLocation = MsBuildLocation;
			return true;
		}
	}
	// END CUSTOM

	// Get the Visual Studio 2019 install directory
	...

```

Now, your project files should generate fine.

* * *

When things start building as expected, there will be an error from some code in `RenderGraphPrivate.cpp`. I don’t have the log anymore, but it’s something about arithmetic overflow. It’s probably due to new checks on newer compilers, and it’s caused by the use of the `INFINITY` macro in `GetClobberColor`. To fix it, while still using infinity as a value, I used `std::numeric_limits<float>::infinity()`:

```cpp
FLinearColor GetClobberColor()
{
	switch (GRDGClobberResources)
	{
	case 1:
		return FLinearColor(1000, 1000, 1000, 1000);
	case 2:
		return FLinearColor(NAN, NAN, NAN, NAN);
	case 3:
	// BEGIN CUSTOM - Fix compilation error about arithmetic overflow with VS 2026
	{
		constexpr float Infinity = std::numeric_limits<float>::infinity();
		return FLinearColor(Infinity, Infinity, Infinity, Infinity);
	}
	// END CUSTOM
	case 4:
		return FLinearColor(0, 0, 0, 0);
	default:
		return FLinearColor::Black;
	}
}

```

**Don’t forget** to add `#include <limits>` at the top of that file, after the existing include, to use that `std` value.

```cpp
#include "RenderGraphPrivate.h"

// BEGIN CUSTOM - Added to use infinity in GetClobberColor
#include <limits>
// END CUSTOM

```

* * *

Things seem to be working for now. I was just trying to compile the `RiderLink` plugin on Rider. Now I’ll try building a project and will report other issues I find.

---

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [February 19, 2026, 5:15am UTC](https://forums.unrealengine.com/t/building-ue-4-27-with-vs-2026/2700816/2 "2026-02-19T05:15:22Z")

</div>

Forgot to mention, I also had to update the target .NET Framework version on `GitDependencies.csproj` and `MemoryProfiler2.csproj` to `4.6.2`. Find `v4.5` and replace it with `v4.6.2`.

```xml
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>

```

---

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [February 19, 2026, 5:23am UTC](https://forums.unrealengine.com/t/building-ue-4-27-with-vs-2026/2700816/3 "2026-02-19T05:23:51Z")

</div>

During compilation, this message will show up a bunch of times:

```plaintext
Detected compiler newer than Visual Studio 2019, please update min version checking in WindowsPlatformCompilerSetup.h

```

I don’t know what the `_MSC_VER` for VS2026 is, but that doesn’t seem to cause any issues. So, I’m choosing to ignore it. I checked the 5.7 source to see what value it was checking against, and it doesn’t even have that check.
