依赖性
每个UE版本依赖的.NET版本都可能不同,UE5.0以前都可以使用3.1版本
UE5.0 依赖.NET 3.1
UE5.1 依赖.NET 6.0
UE源码开发自带.NET第三方库
UE5.0版本
Engine\Binaries\ThirdParty\DotNet\Windows\sdk\3.1.403
UE5.1版本存在路径
Engine\Binaries\ThirdParty\DotNet\6.0.302
UE编辑器开发
需要根据实际情况安装不同版本的.NET
指定UE采用的.NET版本
存在多个版本
dotnet-sdk-3.1.115-win-x64.exe
dotnet-sdk-6.0.411-win-x64.exe
dotnet-sdk-3.1.426-win-x64.exe
添加环境变量:
DOTNET_ROOT C:\Program Files\dotnet\sdk\3.1.115
重启电脑使之生效
UE5.1源码生成解决方案提示异常
Setting up Unreal Engine project files...
Using bundled DotNet SDK version: 6.0.302
Building UnrealBuildTool...
用于 .NET 的 Microsoft (R) 生成引擎版本 17.2.0+41abc5629
版权所有(C) Microsoft Corporation。保留所有权利。
已成功生成。
0 个警告
0 个错误
已用时间 00:00:07.39
Log file: F:\dongshenghua\ue5.1\UnrealEngine\Engine\Programs\UnrealBuildTool\Log_GPF.txt
Some Platforms were skipped due to invalid SDK setup: Mac, IOS, Android, Linux, LinuxArm64, TVOS.
See the log file for detailed information
Visual Studio 2019 does not support .NET 6.0 C# projects, these projects will not be added to the generated solution.
Please generate the Visual Studio 2022 solution if .NET 6.0 C# project support is required.
说明当前已经需要升级VS版本才能使用5.1版本的调试功能
SDK Not Setup
Starting AutomationTool...
Parsing command line: -ScriptsForProject=F:/dongshenghua/xihuan/XiHuan/XiHuan.uproject Turnkey -utf8output -WaitForUATMutex -command=VerifySdk -ReportFilename=F:/dongshenghua/xihuan/XiHuan/Intermediate/TurnkeyReport_2.log -log=F:/dongshenghua/xihuan/XiHuan/Intermediate/TurnkeyLog_2.log -project=F:/dongshenghua/xihuan/XiHuan/XiHuan.uproject -platform=all
Initializing script modules...
Building 29 projects (see Log 'Engine/Programs/AutomationTool/Saved/Logs/Log.txt' for more details)
Restore...
Build...
F:\dongshenghua\ue5.1\UnrealEngine\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Microsoft.Common.CurrentVersion.targets(3262,5): error MSB3554: 无法写入输出文件“F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool\IOS\obj\Development\IOS.Automation.Properties.Resources.resources”。Could not find file 'F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool\IOS\Resources\GreenCheck.png'. (F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool\IOS\IOS.Automation.csproj)
Failed to build: F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool\IOS\IOS.Automation.csproj
Failed to build: F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool\TVOS\TVOS.Automation.csproj
Build projects time: 3.83 s
AutomationTool executed for 0h 0m 6s
AutomationTool exiting with ExitCode=1 (Error_Unknown)
BUILD FAILED
网上解决方案
安装.NET
版本不限于(无效)
dotnet-sdk-3.1.115-win-x64.exe
dotnet-sdk-6.0.411-win-x64.exe
dotnet-sdk-3.1.426-win-x64.exe
有些方案提示需要:C:\Program Files\dotnet\host\fxr\3.1.23\hostfxr.dll 拷贝到Epic Games\UE_5.0\Engine\Binaries\ThirdParty\DotNet\Windows\host\fxr\3.1.9路径下,目前源码版本F:\dongshenghua\ue5.1\UnrealEngine\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\host\fxr\6.0.7
下已经有了
尝试解决方案
将F:\dongshenghua\ue5.1\UnrealEngine\Engine\Source\Programs\AutomationTool目录下的Android/IOS/Linux等文件夹搬移到一个新文件夹backup里面,避免打包这些系统的资源文件
最终解决方案
5.1源码编译版本需要使用VS2022编译开发