GenerateProjectFiles.bat fails when building UE5 from source

Hi all, I’ve been trying (and failing) to build UE5 from source off branch 5.2 (release failed for others reasons) but can’t get past the GenerateProjectFiles.bat step. I’ve successfully checked the project out and ran Setup.bat without seeing any errors or other issues, but when I run GenerateProjectFiles.bat I get:

Setting up Unreal Engine project files...                                                                               
Using bundled DotNet SDK version: 6.0.302                                                                               Building UnrealBuildTool...                                                                                             
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET                                                            

C:\ue-ws\UnrealEngine\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj : error MSB4236: The SDK 'Microsoft .NET.Sdk' specified could not be found.                                                                                                                                                                                                         Build FAILED.

Things I’ve tried so far:

  1. Fully wiping the downloaded files with git clean -xdf and re-running Setup.bat
  2. Installing basically every single sdk/package in the Visual Studio installers for both community editions 2019 and 2022
  3. Locating the exact SDK bundled in the project (6.0.302) and downloading/installing that as a standalone (confirmed existing with dotnet --list-sdks)
  4. Added a globals.json file to explicitly declare the bundled SDK version as a build dependency

Nothing changes the error message. Anyone have suggestions on what else I could try?

1 Like

To update/bump: I switched branches from 5.2 to 5.1, git clean’d my repo, and tried again on this other branch. Same result.

You need to go Engine/Programs/UnrealBuildTool and read the log.txt. But in this case I think is very clear. Install Microsoft .NET SDK

1 Like

As mentioned in the original post, .NET SDK is installed. The exact version they target is installed, despite it also being bundled with the project. There are no UnrealBuildTool logs to examine, as UnrealBuildTool isn’t building.

image

Revisiting this, I was able to track down the actual solution, which had nothing to do with not having a specific SDK installed and more to do with the fact that I’ve been doing .NET development on this computer for a long time.

My MSBuildSDKsPath environment variable was set to a stale SDK path. Setting this variable to where my 6.0 SDK was installed instead of the 2.0 SDK (C:\Program Files\dotnet\sdk\6.0.311\Sdks instead of C:\Program Files\dotnet\sdk\2.0\Sdks) resolved the issue and allowed me to GenerateProjectFiles. Still waiting for the UE5 solution to finish building but no major issues since then!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.