Error when trying to create a new C++ Project. (Failed to generate project files)

Hi

below, you can see the error i am getting when i try to create a new C++ Project. Ive had this working before and this issue has only recently occurred with the latest update.

Failed to generate project files. Log
output: Running C:/Program
Files/Unreal
Engine/4.7/Engine/Binaries/DotNET/UnrealBuildTool.exe
-projectfiles -project=“C:/Users/KHAN/Documents/Unreal
Projects/Training/Training.uproject”
-game -rocket -progress Discovering modules, targets and source code for
game… UnrealBuildTool Exception:
System.ArgumentOutOfRangeException:
Length cannot be less than zero.
Parameter name: length at
System.String.InternalSubStringWithChecks(Int32
startIndex, Int32 length, Boolean
fAlwaysCopy) at
UnrealBuildTool.Utils.SetEnvironmentVariablesFromBatchFile(String
BatchFileName) at
UnrealBuildTool.VCEnvironment…ctor(CPPTargetPlatform
InPlatform) at
UnrealBuildTool.VCToolChain.GetVCIncludePaths(CPPTargetPlatform
Platform) at
UnrealBuildTool.VCProjectFile.WriteProjectFile(List1 InPlatforms, List1 InConfigurations)
at
UnrealBuildTool.ProjectFileGenerator.WriteProjectFiles()
at
UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(String
Arguments, Boolean& bSuccess) at
UnrealBuildTool.UnrealBuildTool.GenerateProjectFiles(ProjectFileGenerator
Generator, String Arguments) at
UnrealBuildTool.UnrealBuildTool.Main(String
Arguments)

TempAttachments

This issue only occurs when you run the Epic Games Launcher through the steam client.

Hi,

This looks like internal error when parsing environment variables set by vcvarsx86_amd64.bat.

It would be extremely useful if you could locate and attach two temporary files created by UnrealBuildTool which are used to obtain those environment variables.

Both of these files are located in the temporary folder:

C:\Users\your.username\AppData\Local\Temp\tmp5E21.tmp.bat
C:\Users\your.username\AppData\Local\Temp\tmp5E21.tmp

tmp5E21 is something that’s not going to look the same on your machine (or even after each UBT run) but you should be able to find two most recent files that look similar in the temporary folder.

@RCL You can add any application as a non-steam game. So you can run it through the steam library.

What do you mean by running Launcher through Steam client? Launcher is not a Steam application.

Why would you do so? (for the launcher)

@RCL Steam library just a nice place to keep all the applications i use.I assume this isent possible then?

I don’t think we tested such a scenario, but we don’t see an obvious reason for it to fail. I hope Core team (Robert) will help you narrow down the problem - I was just double checking that we properly understand what you were doing :slight_smile:

I don’t think we tested such a scenario, but we don’t see an obvious reason for it to fail. I hope Core team (Robert) will help you narrow down the problem - I was just double checking that we properly understand what you were doing :slight_smile:

@robert.manuszewski

I have updated my initial question with a .zip folder containing the two files you require.

Just a quick question will UE4 ever be on steam officially?

For some reason Steam stores a new line character in one of their environment variables and that breaks code responsible for parsing output in UnrealBuildTool. I submitted a fix to guard against that in master branch: https://github.com/EpicGames/UnrealEngine/commit/99a3c70ff4c81249194bc7aa1693b50e048cb64b