Build vscode project files from command line?

I’m most comfortable working in vscode, but there are still some things I need out of regular Visual Studio. I usually have both editors open at the same time. I’d like to find a work flow for generating both VS and VSCode projects. It seems to me like the best solution would be to leave the unreal defaults alone so that it generates VS projects, and generate VSCode projects exclusively from the command line. It looks like there’s support for this in GenerateProjectFilesMode.cs.

But I can’t seem to figure out the correct way to pass these flags. I’ve tried a lot of combinations of:

"/path/to/UnrealVersionSelector.exe" -ProjectFiles "/path/to/my.uproject" -ProjectFileFormat=VSCode

To no avail.

The code you link clearly shows you need to do something like this:

"/path/to/UnrealVersionSelector.exe" -ProjectFiles "/path/to/my.uproject" -VSCode

Have you tried running that command? On my computer that results in the same output as the command I posted. A dialog box that says “Error: Invalid command line”

Well i did it blindly based on code you posted. It should work as i see options that been commonly used during VS version transitions, Hmmm, maybe UnrealVersionSelector dont pass the arguments, try using UnrealBuildTool directly or use GenerateProjectFiles.bat in /Build/BatchFiles in enigne. UBT is tool that deals with everything related to code compilation in UE4, rest is just shortcuts. UAT deals with packageing, but i never tried to run it outside UE4. Technicly you dont even need VS project to build anything, UBT build commends (you can check them in NMake configuration of VS project) will deals with everything, project files are there just for IDE text editor use.

Looking at the source for UnrealVersionSelector, there’s no way to pass -VSCode through to UnrealBuildTool, so you’ll have to call UnrealBuildTool by hand, with parameters something like -projectfiles -project="path\to\your\Project.uproject" -game -rocket -progress -VSCode which is basically the command-line that UnrealVersionSelector is building for you (see the log in the popup) plus -VSCode.

If you are working from a source checkout, there’s Engine\Build\BatchFiles\GenerateProjectFiles.bat which will wrap up some of that, and you can just pass -VSCode to that.

Not sure if you have a UDN account, but I asked something similar there. You’ll need a UDN account to see the post, but definitely worth getting an account!

The flag you’re looking for is -VSCode for sure. You can see all the editors supported by GenerateProjectFiles in the UnrealBuildTools.cs file.

Hope this helps!

I am also gonna highly endorse Rider for Unreal. My team and I have switched over to it and are huge fans. VSCode becomes a bit too chunky with all the extensions I ended up using for Unreal C++ development, along with all the other webdev extensions I use VSCode for.

Also should edit Engine\Saved\UnrealBuildTool\BuildConfiguration.xml

<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="">

That won’t help in this case, because the user is generating for both VSCode and Visual Studio, so they’d have to change that file back-and-forth each time they regenerate their solutions.

For some reason, this answer just showed up as “new” for me, but I realise it’s old, maybe the new comment triggered the notification. Anyway, the UDN link is broken (I have UDN access, but they changed backends around late last year and all the existing links broke).

For anyone coming along now, as I mentioned in my answer, you can’t use -VSCode here because UnrealVersionSelector does not pass that flag through to UnrealBuildTool.