Upgrading c++ project from 4.20.3 to 4.21p1 Error: Couldn't find target rules file

So I keep getting this error:

ERROR: Couldn't find target rules file for target 'UE4Editor' in rules assembly 'UEProject, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

full log.txt

UnrealBuildTool.GuardedMain: Command line: "c:/Program Files/Epic Games/UE_4.21/Engine/Binaries/DotNET/UnrealBuildTool.exe" Development Win64 -Project="D:/UEProject 4.21 - 2/UEDevCourse.uproject" -TargetType=Editor -Progress -NoHotReloadFromIDE
GitSourceFileWorkingSet..ctor: Using 'git status' to determine working set for adaptive non-unity build (D:\UEProject 4.21 - 2).
UnrealBuildTool.RunUBT: Creating makefile for UEDevCourseEditor (no existing makefile)
Log.WriteException: ==============================================================================
Log.WriteException: ERROR: Couldn't find target rules file for target 'UE4Editor' in rules assembly 'UEDevCourseModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Log.WriteException:        Location: D:\UEProject 4.21 - 2\Intermediate\Build\BuildRules\UEDevCourseModuleRules.dll
Log.WriteException:        Target rules found:
Log.WriteException:        	UEDevCourse - D:\UEProject 4.21 - 2\Source\UEDevCourse.Target.cs
Log.WriteException:        	UEDevCourseEditor - D:\UEProject 4.21 - 2\Source\UEDevCourseEditor.Target.cs
Log.WriteException:        
Log.WriteException:        (see ../Programs/UnrealBuildTool/Log.txt for full exception trace)
Log.WriteException: 
Log.WriteException: BuildException: Couldn't find target rules file for target 'UE4Editor' in rules assembly 'UEDevCourseModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Log.WriteException: Location: D:\UEProject 4.21 - 2\Intermediate\Build\BuildRules\UEDevCourseModuleRules.dll
Log.WriteException: Target rules found:
Log.WriteException: 	UEDevCourse - D:\UEProject 4.21 - 2\Source\UEDevCourse.Target.cs
Log.WriteException: 	UEDevCourseEditor - D:\UEProject 4.21 - 2\Source\UEDevCourseEditor.Target.cs
Log.WriteException: 
Log.WriteException:    at UnrealBuildTool.RulesAssembly.CreateTargetRules(String TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, String Architecture, FileReference ProjectFile, ReadOnlyBuildVersion Version, String[] Arguments, FileReference& TargetFileName) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 583
Log.WriteException:    at UnrealBuildTool.RulesAssembly.CreateTargetRules(String TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, String Architecture, FileReference ProjectFile, ReadOnlyBuildVersion Version, String[] Arguments) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 543
Log.WriteException:    at UnrealBuildTool.UEBuildTarget.ValidateSharedEnvironment(RulesAssembly RulesAssembly, String ThisTargetName, TargetRules ThisRules) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 547
Log.WriteException:    at UnrealBuildTool.UEBuildTarget.CreateTarget(TargetDescriptor Desc, String[] Arguments, Boolean bSkipRulesCompile, Boolean bCompilingSingleFile, Boolean bUsePrecompiled, ReadOnlyBuildVersion Version) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 406
Log.WriteException:    at UnrealBuildTool.UnrealBuildTool.RunUBT(BuildConfiguration BuildConfiguration, String[] Arguments, FileReference ProjectFile, Boolean bCatchExceptions) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 1415
Log.WriteException: ==============================================================================

Any ideas what’s causing this? Project opens and works fine on 4.20.3. Tried making new project in 4.21p1 and it compiles fine.

The problem stems from the Datasmith / Unreal Studio plugin. This plugin works differently than other plugins in the fact that it creates its own module and cannot be disabled in the same manner.

To resolve this issue, there are two things you can do.

  1. In the .uproject file, you can remove the line mentioning Enterprise which is as follows:

“Enterprise”: true,

  1. You can install the 4.21 version of the Datasmith plugin.

After doing either of these steps, please generate project files again and the compilation should proceed as normal.

While this isn’t exactly a bug and this is the way it is meant to work. Feature request has been entered to improve the error messaging.