Can't generate VS solution the intended way using source rather than binaries

According to this question it appears that the way in which you generate a VS solution is to use GenerateProjectFiles.bat passing the full path to the .uproject file as the argument. RegisterShellCommands.bat also confirms that. Well, that doesn’t work for me - what it does is to recreate the UE4 solution but generates nothing for my own project.

Looking at what the script does (and I can reproduce this manually), it calls:

..\Binaries\DotNET\UnrealBuildTool.exe -ProjectFiles <path to my .uproject file>

… but that just recreates the UE4.sln and relevant files. Now, if I modify that script to instead do:

..\Binaries\DotNET\UnrealBuildTool.exe -ProjectFiles -rocket <path to my .uproject file>

…then everything works as expected.

For now I’m just going to use RocketGenerateProjectFiles.bat until somebody can tell me why the behavior isn’t working as intended?

Here’s the output from UnrealBuildTool without the -rocket switch (which is the default in GenerateProjectFiles.bat):

C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source>..\Binaries\DotNET\UnrealBuildTool.exe -ProjectFiles C:\Users\Neil\Prototype\PrototypeOC\PrototypeOC.uproject
    Binding IntelliSense data... 100%
    Writing project files... 100%

And here’s what I see when I pass the -rocket switch (which works!):

C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source>..\Binaries\DotNET\UnrealBuildTool.exe -ProjectFiles -rocket C:\Users\Neil\Prototype\PrototypeOC\PrototypeOC.uproject
    Discovering modules, targets and source code for project...
    Binding IntelliSense data... 100%
    Writing project files... 100%

And, just so you have more information, I can see that it DOES generate a new UE4.sln which contains my project. But my project doesn’t build there. Instead I get:

1>EXEC : error : Couldn't find target rules file for target 'PrototypeOCEditor' in rules assembly 'PrototypeOCEditorModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
1>  Location: C:\Users\Neil\Documents\GitHub\UnrealEngine\Intermediate\Build\BuildRules\PrototypeOCEditorModuleRules.dll
1>  Target rules found:
1>  	UE4Client - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\UE4Client.Target.cs
1>  	UE4Editor - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\UE4Editor.Target.cs
1>  	UE4Game - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\UE4Game.Target.cs
1>  	UE4Server - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\UE4Server.Target.cs
1>  	BlankProgram - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\Programs\BlankProgram\BlankProgram.Target.cs
1>  	CrashReportClient - C:\Users\Neil\Documents\GitHub\UnrealEngine\Engine\Source\Programs\CrashReporter\CrashReportClient\CrashReportClient.Target.cs

1>  
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat PrototypeOCEditor Win64 DebugGame "C:\Users\Neil\Documents\GitHub\UnrealEngine\UE4.uproject"" exited with code -1.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Sorry this isn’t working for you - it sounds like a bug we’ve fixed in the hotfix release we’re planning for early next week. I think the correct command line to generate project files should be:

..\Binaries\DotNET\UnrealBuildTool.exe -ProjectFiles -project=<path to my .uproject file> -game -engine

But this is just a workaround for a bug that’s in RegisterShellCommands.bat, where it gets all the paths wrong if you use “Run as Administrator” from explorer.

If you open an administrator command prompt, change to the Engine\Build\BatchFiles directory, and run RegisterShellCommands.bat from there, you should be able to just right click on your .uproject and have it generate project files for you correctly.