How can I run GenerateProjectFiles.bat on external projects?

I have Visual Studio 2013 express at the moment.

So far I’ve been able to run GenerateProjectFiles.bat from within the UnrealEngine source folder. If I copy a project into the UnrealEngine folder and run GenerateProjectFiles.bat it adds the project to the UE4.sln. However when I try to run the game after setting it as the startup project it says

Failed to open descriptor file ‘…/…/…/UE4.uproject’ or something along those lines.

If I do the same for ShooterGame however, it runs just fine. It’s only on my newly made FirstPersonShooter base game that it fails.

I’ve only been able to run my game from within Visual Studio if it’s the solution generated for me by the editor initially.
I haven’t found a way to regenerate this solution later though. I imagine it uses GenerateProjectFiles.bat but specifies that the home directory is outside of UnrealEngine somehow, which isn’t documented.

Maybe try generate project files by clicking right click on uproject and “Generate Project Files”

Oh cool. Didn’t realize that was an option. So you can right click on the .uproject file in explorer itself on Windows and that option is present.

It doesn’t include the engine source though.

I’d really like to know how to run the command manually with all the correct arguments from an arbitrary directory.

It’s very easy actually, just make a batch file with this code in the same folder as your .uproject file, then change it to suit your needs.

call "%~dp0..\..\UnrealEngine\GenerateProjectFiles.bat" "%~dp0YourGameProject.uproject" -Game -Engine

I managed to actually get this working as well but I was wondering what the %~dp0 means.

I had to write in absolute paths because for some reason the tool didn’t recognize any combinations of relative paths.

I don’t keep my game inside the engine source directory because the Windows Github app gets slowed down to a crawl. It thinks I want to include my entire game source code as a commit, and tracking that seems to slow it down. I also want to avoid editing the .ignore file so it stops bugging me about comitting the .ignore file.

%~dp0 will evaluate to the drive letter and path of the batch file itself plus a trailing slash.

batch file - What does %~dp0 mean, and how does it work? - Stack Overflow http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true
http://www.911cd.net/forums//index.php?showtopic=3730

There’s no reason relative paths shouldn’t work for what you’re doing. Personally I never put the game in the engine folder, I made a special folder in the root of one of my data drives, one is for the engine source, the other is for projects. That way I can copy my .bat to each of my projects, and all I have to do is change the name to match the .uproject file.