keywords: [UE4]Generate Visual Studio工程时如何指定VS版本

slogan_image

keywords:UE4 generate visual studio project file、VS2017

UE4

UE4 generate visual studio project file cmd

"%UE4PATH%\Engine\Build\BatchFiles\GenerateProjectFiles.bat" %~dp0\MyProject.uproject -2017
注意:GenerateProjectFiles.bat在源码编译的UE4中,Launcher安装版本的UE4没有GenerateProjectFiles.bat。

【2017-08-31记】
今天发现4.17版本用上述方法貌似有问题,会打印一个警告,且最终没有生成任何文件:

warning MSB3884: Could not find rule set file "ManagedMinimumRules.ruleset"

解决办法:
执行以下命令,末尾参数2017即表示指定VS2017:

D:/UE4/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="D:/MyGame/MyGame.uproject" -game -engine -progress -2017

另外UnrealBuildTool.exe在Launcher安装版本也存在,不需要源码编译的版本。

参考:
https://answers.unrealengine.com/questions/579186/what-about-visual-studio-2017-in-ue4.html

官方文档:
https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/ProjectFileGenerator/index.html

UE5

Genarate Visual Studio project files for engine only:

D:\UE5>dotnet Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll -ProjectFiles

If pop error on executing command:

A game project path was not specified, which is required when generating project files using an installed build or passing -game on the command line

Solution:
Delete file: Engine\Build\InstalledBuild.txt.

Genarate Visual Studio project files for game:

dotnet "D:\UE5\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" -projectfiles -project="D:/TestTP/TestTP.uproject" -game -rocket -progress -log="D:\TestTP/Saved/Logs/UnrealVersionSelector-2025.06.09-11.17.06.log"
Visual Studio 所需的最低 Windows SDK 版本

【2018-11-25】
4.18需要安装 Windows SDK 8.1,否则无法 Generate VS project file;
4.20不需要安装 Windows SDK 8.1,只需点选最新版本的 Windows SDK 即可。


琵琶弦上说相思,当时明月在,曾照彩云归。---晏几道《临江仙》