5.1 Error when creating new C++ template project

I just tried to create a new C++ test project based on the ThirdPerson example project and received the error below. Please note that I can create new C++ projects in 4.27.2 and 5.0.3 on this PC without any issues.

An error occurred while trying to generate project files.

Running C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat  -projectfiles -project="C:/Projects/PerforceDepot/ThirdPersonTest/ThirdPersonTest.uproject" -game -rocket -progress
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -projectfiles -project="C:/Projects/PerforceDepot/ThirdPersonTest/ThirdPersonTest.uproject" -game -rocket -progress
Log file: C:\Users\sascha\AppData\Local\UnrealBuildTool\Log_GPF.txt

Some Platforms were skipped due to invalid SDK setup: IOS, Android, Linux, LinuxArm64.
See the log file for detailed information

Discovering modules, targets and source code for project...
Binding IntelliSense data...
Binding IntelliSense data... 100%
Writing project files...
Writing project files... 0%
Unhandled exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.GC.AllocateNewArray(IntPtr typeHandle, Int32 length, GC_ALLOC_FLAGS flags)
   at System.GC.<AllocateUninitializedArray>g__AllocateNewUninitializedArray|66_0[T](Int32 length, Boolean pinned)
   at System.Text.StringBuilder.ExpandByABlock(Int32 minBlockCharCount)
   at System.Text.StringBuilder.Append(Char* value, Int32 valueCount)
   at System.Text.StringBuilder.AppendHelper(String value)
   at System.Text.StringBuilder.Append(String value)
   at UnrealBuildTool.VCProjectFile.AppendIncludePaths(StringBuilder Builder, IncludePathsCollection Collection, HashSet`1 IgnorePaths) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProject.cs:line 825
   at UnrealBuildTool.VCProjectFile.WriteProjectFile(List`1 InPlatforms, List`1 InConfigurations, PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProject.cs:line 1251
   at UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 2812
   at UnrealBuildTool.VCProjectFileGenerator.WriteProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProjectFileGenerator.cs:line 480
   at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String[] Arguments, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 1176
   at UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 233
   at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 648

3 Likes

Same Issue !!

1 Like

Having the same issue. I posted the issue in the 5.1 Release Announcement thread, but no one has replied so far. Glad to have confirmation that I’m not the only one having this issue.

I also created a thread on the subject.

1 Like


installing the .NET SDK fixed the issue

This topic has been moved from international to Programming & Scripting: C++.

When posting, please review the categories to ensure your topic is posted in the most relevant space. Hopefully, the category change of this topic will help to get you answers or help others in the future. :slight_smile:

Thanks so much for being a part of the Unreal Engine community!
-Panda

Didn’t work for me unfortunately. Would you mind listing / sharing all the components that you have installed for VS 2019?

Here’s my install:




These install settings are based on the official documentation for 5.1 and with this install, I am able to create new 5.0 C++ projects and generate project files. But I get the crash for 5.1.

Thanks!

Same issue here too…don’t know how to fix it…

Don’t work here

In case you get an error code 6 from VS 2019, check that you have installed all the required tools, given by the docs:

Verify the tools below are installed:

  • C++ profiling tools
  • C++ AddressSanitizer
  • Windows 10 SDK (10.0.18362 or Newer)
  • Unreal Engine installer"

You can check by open “Visual Studio Installer” and go to the tab “Workloads” and then select “Desktop Development with C++” (naming may be a little bit different).

In my case Windows 10 SDK (10.0.18362 or Newer) was not installed by default when I installed VS 2019.

I just had to install the Windows 10 SDK and then I restarted my computer. Also, check that you have enough disk space in your C:/user/username/AppData/UnrealEngine (or just C:/ drive)

After doing this, I was able to setup a fresh (empty) C++ project in UE 5.1.

Hope this helps.

1 Like

They update the page about setting the visual studio for unreal engine adding 5.1 with new specific requisites and now it’s working!!!:partying_face: :+1:t2:

This is what fixed it for me:

None of the fixes worked for me. With engine version 5.03 everything works fine, but with 5.1 it can create only blueprint projects. As soon as c++ project template is chosen it keeps giving this error. I’ve tried to add also a c++ class into a blueprint project but still fails and says it cannot compile. I have every tool listed in 5.1 release notes and still do not understand why it fails. Does somebody else have the same issue or maybe resolved it already?
This is the error message on project creation:
Running P:/UE_5.1/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“C:/Users/user/Documents/Unreal Projects/MyProject6/MyProject6.uproject” -game -rocket -progress
The system cannot find the path specified.
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/Users/user/Documents/Unreal Projects/MyProject6/MyProject6.uproject” -game -rocket -progress
Log file: C:\Users\user\AppData\Local\UnrealBuildTool\Log_GPF.txt

Some Platforms were skipped due to invalid SDK setup: Android, Linux, LinuxArm64.
See the log file for detailed information

Discovering modules, targets and source code for project…
Binding IntelliSense data…
Binding IntelliSense data… 100%
Writing project files…
Writing project files… 100%

Doesn’t output any exception or log file at all. I’ve run out of ideas.

1 Like

@henrihaka1
It could definitely be a .NET Core issue. My best solution for this is to either update it usually, but I noticed on mine that my .NET was installed in C:\programs\dotnet and I still had an old SDK version in C:\programs (x86)\dotnet, and copied the newer SDK over.
I hope this can help you, this seems to be a common issue!
-Zen

1 Like

Unfortunatelly I tried that too. I seriously do not get why it is happening. I event tried in my linux machine and there works without a problem. I am currently trying to build the engine from source code right now and hope it works like that but I seriously doubt that. Maybe later I will attach my VS2022 individual componenets so somebody more skilled than me can catch where the error might be.
Thanks for your repply anyway!


image
Also I just made sure to paste C:/Program Files/dotnet into C:Program Files (x86). Still no result and same error.

After installing .net, uwp and development with C++ it worked for me :+1:

Unfortunatelly I still have no luck. For any other unlocky guy like me a temporary workaround (that actally works for me) might be to create your project manually and build from cmd P:\UE_5.1\Engine\Build\BatchFiles\Build.bat MyProjectEditor Win64 Development -Project=“C:\Users\user\Desktop\ueProject\myProject\myProject.uproject” -WaitMutex -FromMsBuild

If it doesn’t bother you much, could you upload the individual components you have selected pls?

I was having this issue also where I had the dependancies installed but could not generate the files for a template.

Fixed it by changing the dotnet environment variable to be in the correct order. Moved the x64 sdk variable to the top.

image

1 Like

I have Visual Studio 2022 (all dependencies installed) and Unreal 5.1.
If I want to create a new C++ project from Blank or any other template I get: