Issue packaging (Resolved)

My situation was a little different as I had already installed Windows SDK 10 in both VS2019 and VS2022 and also installed Dotnet 3.1 and UE5 was able to build fine in VS and also in the live coding editor. Only the packaging build couldn’t find it. In my case I also had .NET 6 installed on my machine and the packaging tool found that instead of 3.1 and was complaining:

UATHelper: Packaging (Windows): Running AutomationTool...
UATHelper: Packaging (Windows): It was not possible to find any compatible framework version
UATHelper: Packaging (Windows): The framework 'Microsoft.WindowsDesktop.App', version '3.1.0' (x64) was not found.
UATHelper: Packaging (Windows):   - The following frameworks were found:
UATHelper: Packaging (Windows):       6.0.3 at [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
UATHelper: Packaging (Windows): You can resolve the problem by installing the specified framework and/or SDK.
UATHelper: Packaging (Windows): The specified framework can be found at:
UATHelper: Packaging (Windows):   - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=3.1.0&arch=x64&rid=win10-x64
UATHelper: Packaging (Windows): Updating environment variables set by a Turnkey sub-process

I followed some of other’s instructions (not sure if step 1 is required)

  1. Copy “C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\DotNet\Windows\host\fxr\3.1.9\hostfxr.dll” to C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\DotNET\AutomationTool per SDK Not Setup UE5 - YouTube
  2. Set the DOTNET_ROOT environment variable to UE5’s bundled version of dotnet: C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\ThirdParty\DotNet\Windows
  3. Edit the PATH variable and put %DOTNET_ROOT% in front of C:\Program Files\dotnet\

Then restart the editor and now it can package Windows!