It seems that projects all contains a dependency on UnrealBuildTool, e.g.
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "Engine\Intermediate\ProjectFiles\M2Development.vcxproj", "{0E758EC9-BA36-3D62-994B-326C861BB9F4}"
ProjectSection(ProjectDependencies) = postProject
{7E468C9C-2CAF-3A25-AE9C-2199BEDEB41A} = {7E468C9C-2CAF-3A25-AE9C-2199BEDEB41A}
EndProjectSection
EndProject
Where we have:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnrealBuildTool", "Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj", "{7E468C9C-2CAF-3A25-AE9C-2199BEDEB41A}"
When building with Rider, this dependency then causes a bunch of unnecessary extra projects to be built when building our game project, e.g.
CONSOLE: Use build tool: C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe
15:06:37 Building C:\dev\m2up\Game\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.Build\EpicGames.Build.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.Horde\EpicGames.Horde.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.IoHash\EpicGames.IoHash.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.OIDC\EpicGames.OIDC.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.Serialization\EpicGames.Serialization.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.UBA\EpicGames.UBA.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.UHT\EpicGames.UHT.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.MsBuild\EpicGames.MsBuild.csproj
15:06:38 Building C:\dev\m2up\Game\Engine\Source\Programs\Shared\EpicGames.Oodle\EpicGames.Oodle.csproj
When using visual studio, it seems that it is detected that they don’t need to be built, and so are skipped, where they aren’t in Rider.
I was wondering whether you could provide context on this UBTProject dependency? In our project, I have removed it with the following change to VCProjectFileGenerator.cs, which has noticeably improved build times through rider and doesn’t seem to have any issues so far:
// Setup dependency on UnrealBuildTool, if we need that. This makes sure that UnrealBuildTool is
// freshly compiled before kicking off any build operations on this target project
if (!CurProject.IsStubProject)
{
List<ProjectFile> Dependencies = new List<ProjectFile>();
if (CurProject.IsGeneratedProject && UBTProject != null && CurProject != UBTProject)
{
// M2_ENGINE_CHANGE_BEGIN
// 26/87/2025 - Ben Naccarato - don't add the UBTProject dependency for the game uproject (this causes unnecessary extra files to be dragged in to builds when using Rider)
// (Check that we have a target that points to a non-engine uproject)
if (CurProject.ProjectTargets.Any(t => t.UnrealProjectFilePath != null && !t.UnrealProjectFilePath.IsUnderDirectory(Unreal.EngineDirectory)))
{
Console.WriteLine(); // Add an extra line to ensure we're not on the same line as the e.g. "Writing project files... 99%"
Console.WriteLine("Skipping UBT Project dependency for " + CurProject.ToString());
}
else
{
Dependencies.Add(UBTProject);
}
// M2_ENGINE_CHANGE_END
Dependencies.AddRange(UBTProject.DependsOnProjects);
}
Dependencies.AddRange(CurProject.DependsOnProjects);