I have both visual studio 2017 and 2019 installed both have the correct install settings with the appropriate Unreal Engine installer options ticked on. I have also gone to the link referenced in the error and installed .NET 5.0 and it still didn’t work even after restarting the PC. I have also tried with .NET 3.0 and .NET 6.0 but still no luck. I’ve tried reinstalling UE5 as well. Below is the info from the package menu.
You shouldn’t need to reinstall any dotnet core because the 5.0EA already ships with the correct dotnet core. The automation scripts just don’t seem to use it. You can work around this by setting the environment variable DOTNET_ROOT to %ENGINE_DIR%\Engine\Binaries\ThirdParty\DotNet\Windows (replace %ENGINE_DIR% with your 5.0EA install directory).
This is applicable if you see the hostfxr.dll error or if you see something like “The specified framework ‘Microsoft.WindowsDesktop.App’, version ‘3.1.0’ was not found”.
In my opinion this could be a simple fix on Epic’s side to actually use the dotnet core that the engine comes with.
Unfortunately, none of the proposed solutions worked for me for either building from source or packaging a game with the prebuilt UE5 binary.
It’s clear that the bundled DotNet is being used as I get Using bundled DotNet SDK from the Build.bat, so that’s not the issue.
For some reason UBT is being configured for CompilerVersion = VisualStudio2017 despite even changing Engine/Config/BaseEngine.ini to have CompilerVersion=VisualStudio2019 under [/Script/WindowsTargetPlatform.WindowsTargetSettings].
I only could get it to work by manually adding the -2019 command line parameter at the end of calling Build.bat in Visual Studio. This solution is kind of ugly when considering how the engine will call the automation tool during packaging.
I didn’t find anything in my environment variables that would indicate 2017 is being preferred.
I figured out my particular issue and it’s highly uncommon, but incase someone is in the same boat:
At some point, I added C:\Users\<user>\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml and hardcoded the compiler to VisualStudio2017. I did this because of some silly configuration I was figuring out with developing code plugins.
Deleting the file worked, and probably is the correct path forward when developing on both UE4 and UE5 targets.
@David.Sullins I already did this before, using the “Advanced System Settings” option. When I go to the “Environment Variables” window “DOTNET_ROOT” is nowhere to be found (it isn’t listed when using the PowerShell method either). If I create a new environment variable, name it “DOTNET_ROOT” and then set it’s value to the path you mentioned earlier nothing happens. Absolutely no difference, still can’t package my Windows projects.
Can you show me your “Enviroment Variables” window (or a list of your environment variables)? It’s very strange that “DOTNET_ROOT” doesn’t exist for me.
We seem to have very similar issues, I just hope that because the title of this thread now has ‘resolved’ added to it, that it doesn’t stagnate the discussion
Hi everyone, It is good to see that a lot of people have been able to find the solution on this thread. Unfortunately I am still struggling with this issue, an assistance would be much appreciated?
The strangest thing is that my old PC seems to be just fine, but I still can’t package on my preferred workstation. Maybe a full uninstall, and then re-install might help. (only hoping)