Can't generate visual studio project files

Hello,
I can’t generate the visual studio files after imported the project from UE5.3 to UE5.4.

the error is this:
C:\Users""\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(238,13): error CS0246: The type or namespace name ‘JsonParseException’ could not be found (are you missing a using directive or an assembly reference?)

but i don’t understand why it happen, the oldest version don’t have this error. (UE5.2 and UE5.3)

Log files.

Generating VisualStudio project files:
Discovering modules, targets and source code for project…
Updating D:\Epic Games\UE_5.4\Engine\Intermediate\ProjectFiles\PrimaryProjectPath.txt: contents have changed. Saving previous version to D:\Epic Games\UE_5.4\Engine\Intermediate\ProjectFiles\PrimaryProjectPath.txt.old.
Found VisualStudio2022 installation: C:\Program Files\Microsoft Visual Studio\2022\Community (Product=Microsoft.VisualStudio.Product.Community, Version=17.10.34928.147)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933 (Family=14.34.31933, FamilyRank=4, Version=14.34.31948, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532 (Family=14.36.32532, FamilyRank=2, Version=14.36.32545, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.36.32532)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807 (Family=14.40.33807, FamilyRank=5, Version=14.40.33811, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807)
Detected supported platforms: Win64
Skipping D:\Epic Games\UE_5.4\Engine\Intermediate\Build\BuildRules\UE5Rules.dll: File is installed
Skipping D:\Epic Games\UE_5.4\Engine\Intermediate\Build\BuildRules\UE5ProgramRules.dll: File is installed
Compiling C:\Users\matte\Desktop\LyraStarterGame 5.4\Intermediate\Build\BuildRules\LyraStarterGameModuleRules.dll: Assembly does not exist
Adding event matcher: CompileEventMatcher
Adding event matcher: LinkEventMatcher
Adding event matcher: MicrosoftEventMatcher
Adding event matcher: XoreaxEventMatcher
C:\Users"“\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(83,6): warning CS0618: ‘Log.TraceWarning(string, params object?)’ is obsolete: ‘Use Logger.LogWarning with a message template instead; see https://tinyurl.com/bp96bk2r.
C:\Users"”\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(159,8): warning CS0618: ‘Log.TraceWarning(string, params object?)’ is obsolete: ‘Use Logger.LogWarning with a message template instead; see https://tinyurl.com/bp96bk2r.
C:\Users"“\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(198,9): warning CS0618: ‘Log.TraceVerbose(string, params object?)’ is obsolete: ‘Use Logger.LogDebug with a message template instead; see https://tinyurl.com/bp96bk2r.
C:\Users"”\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(202,9): warning CS0618: ‘Log.TraceVerbose(string, params object?)’ is obsolete: ‘Use Logger.LogDebug with a message template instead; see https://tinyurl.com/bp96bk2r.
C:\Users"“\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(212,8): warning CS0618: ‘Log.TraceVerbose(string, params object?)’ is obsolete: ‘Use Logger.LogDebug with a message template instead; see https://tinyurl.com/bp96bk2r.
C:\Users"”\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(238,13): error CS0246: The type or namespace name ‘JsonParseException’ could not be found (are you missing a using directive or an assembly reference?)
C:\Users""\Desktop\LyraStarterGame 5.4\Source\LyraGame.Target.cs(251,6): warning CS0618: ‘Log.TraceVerbose(string, params object?)’ is obsolete: ‘Use Logger.LogDebug with a message template instead; see https://tinyurl.com/bp96bk2r.
Total execution time: 1.65 seconds
Expecting to find a type to be declared in a target rules named ‘LyraClientTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.
CompilationResultException: Expecting to find a type to be declared in a target rules named ‘LyraClientTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.
at UnrealBuildTool.RulesAssembly.CreateTargetRules(String TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, UnrealArchitectures Architectures, FileReference ProjectFile, CommandLineArguments Arguments, ILogger Logger, Boolean IsTestTarget, Boolean bSkipValidation, UnrealIntermediateEnvironment IntermediateEnvironment) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 852
at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List1 AllGames, List1 AllTargetFiles, String Arguments, List1 EngineProjects, List1 GameProjects, Dictionary2 ProjectFileToUProjectFile, Dictionary2 ProgramProjects, Dictionary`2 RulesAssemblies, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2782
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments, Boolean bCacheDataForEditor, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 1038
at UnrealBuildTool.GenerateProjectFilesMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 65
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 660
WriteFileIfChanged() wrote 1 changed files of 2 requested writes.
Timeline:

Greetings @Revelage

With that error, I’d start by making sure you’re running the most recent VS and then also get the latest .NET Framework. I’ve saw CS0246 due to outdate framework a number of times and it may be the problem you’re having as well. If it’s not resolved after both of those, post back. I’ll monitor the thread.

i have the latest version of VS and .NET framework.
Maybe i have to install another .NET framework to resolve, but i don’t know which one.

There’s a compatibility based on UE version here that may help answer that. Setting Up Visual Studio Development Environment For C++ Projects In Unreal Engine | Unreal Engine 5.4 Documentation | Epic Developer Community

I have the same issue I’m pretty sure. New 5.4.2 build, attempting to upgrade project from 5.3.2. Base code is vanilla, but I have a custom plugin that I was working on. I get the same error as OP.

Generating VisualStudio2022 project files:
Discovering modules, targets and source code for project…
D:\Unreal Projects\LyraPlayBranch\Source\LyraGame.Target.cs(248,13): error CS0246: The type or namespace name ‘JsonParseException’ could not be found (are you missing a using directive or an assembly reference?)
Total execution time: 2.57 seconds
Expecting to find a type to be declared in a target rules named ‘LyraClientTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.

Here’s the log details:

Generating VisualStudio2022 project files:
Discovering modules, targets and source code for project…
Found VisualStudio2022 installation: C:\Program Files\Microsoft Visual Studio\2022\Community (Product=Microsoft.VisualStudio.Product.Community, Version=17.10.34928.147)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933 (Family=14.34.31933, FamilyRank=4, Version=14.34.31948, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532 (Family=14.36.32532, FamilyRank=2, Version=14.36.32545, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.36.32532)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130 (Family=14.38.33130, FamilyRank=0, Version=14.38.33138, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807)
Found Visual Studio toolchain: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807 (Family=14.40.33807, FamilyRank=5, Version=14.40.33811, Is64Bit=True, ReleaseChannel=Latest, Architecture=x64, Error=False, Redist=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.40.33807)
Detected supported platforms: Win64
Skipping D:\Unreal Engine\UE_5.4\Engine\Intermediate\Build\BuildRules\UE5Rules.dll: File is installed
Skipping D:\Unreal Engine\UE_5.4\Engine\Intermediate\Build\BuildRules\UE5ProgramRules.dll: File is installed
Generating target Editor for D:\Unreal Projects\LyraPlayBranch\Intermediate\ProjectFiles\UE5.vcxproj
Generating target Game for D:\Unreal Projects\LyraPlayBranch\Intermediate\ProjectFiles\UE5.vcxproj
Compiling D:\Unreal Projects\LyraPlayBranch\Intermediate\Build\BuildRules\LyraStarterGameModuleRules.dll: Assembly does not exist
Adding event matcher: CompileEventMatcher
Adding event matcher: LinkEventMatcher
Adding event matcher: MicrosoftEventMatcher
Adding event matcher: XoreaxEventMatcher
D:\Unreal Projects\LyraPlayBranch\Source\LyraGame.Target.cs(248,13): error CS0246: The type or namespace name ‘JsonParseException’ could not be found (are you missing a using directive or an assembly reference?)
Total execution time: 1.92 seconds
Expecting to find a type to be declared in a target rules named ‘LyraClientTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.
CompilationResultException: Expecting to find a type to be declared in a target rules named ‘LyraClientTarget’. This type must derive from the ‘TargetRules’ type defined by UnrealBuildTool.
at UnrealBuildTool.RulesAssembly.CreateTargetRules(String TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, UnrealArchitectures Architectures, FileReference ProjectFile, CommandLineArguments Arguments, ILogger Logger, Boolean IsTestTarget, Boolean bSkipValidation, UnrealIntermediateEnvironment IntermediateEnvironment) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\RulesAssembly.cs:line 852
at UnrealBuildTool.ProjectFileGenerator.AddProjectsForAllTargets(PlatformProjectGeneratorCollection PlatformProjectGenerators, List1 AllGames, List1 AllTargetFiles, String Arguments, List1 EngineProjects, List1 GameProjects, Dictionary2 ProjectFileToUProjectFile, Dictionary2 ProgramProjects, Dictionary`2 RulesAssemblies, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2782
at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String Arguments, Boolean bCacheDataForEditor, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 1038
at UnrealBuildTool.GenerateProjectFilesMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 65
at UnrealBuildTool.UnrealBuildTool.Main(String ArgumentsArray) in D:\build++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 660
WriteFileIfChanged() wrote 0 changed files of 2 requested writes.

I just ran into this, I am not exactly sure what (SDK) change is causing this, but the solution is to change JsonParseException to just Exception in LyraGame.Target.cs. Apparently the Lyra source already made this change some time ago on GitHub, so it’s not a hack.

9 Likes

Doesn’t mean it’s not a hack ^^