-
Notifications
You must be signed in to change notification settings - Fork 176
Add support for Visual Studio 2022 #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Run with VS2022 on GitHub CI: https://github.com/jonpas/ue4-docker/runs/6395495344 Fails on VS installation, will be poking at this over the next few days. |
There are issues with MS infra today, so CI failure could be unrelated to your changes. |
|
I've started |
Sounds good, I am going to start a build on 4.27 soon here:
|
Failed with
No, we can't change that because UE4 explicitly requires 4.6.2, so 4.6.1 won't work. |
I am getting this on 4.27.2:
Tried adding |
Possibly |
Trying
|
No-no. There ain't such thing as I literally talk about |
Ooooh... those pages are so confusing to navigate. I was looking at the VS2019 one. 🤦 |
No clue where that comes from. |
|
Apparently |
I'm not sure how that is possible. C# 6 support has to be in .NET 4.6, according to Wikipedia. |
I was just about to say that. 🤔 |
Okaay, another approach: remove Note that we still need to list But I am still completely puzzled where we get pre-C#6 compiler from. |
I will attempt that. |
So, the plan is: VS2017 will react to VS2019 will react to all VS2022 will react to If you have simpler ways to get a working 4.6.2 toolchain across multiple VS versions, I'm all ears :D |
Worked to the same point, still the same C#6 error. I am really confused what it's picking up.
It's a mess. |
I'm starting a new attempt: Remove The motivation behind this combo is that we ask the beast to install whatever compiler is the best on given VS version plus our target SDK. If this works, we'll need to retest VS2017 because its docs say that |
VS2022 cannot even compile UE-5.0.1:
According to this, 4.27 is also affected. |
BTW, this seems like the way to go. I'll retest VS2017 + something old (like UE-4.20) and if that works, we'll declare .NET solved. |
Nice job on .NET! I guess VS2022 support can still be merged for whenever engine compilation in UE5 is fixed? |
We could potentially apply this as a patch in ue4-source or ue4-minimal? |
Note that neither 4.26 nor 4.25 was actually tested. Also, as of today, latest VS2022 crashes even with UE 5/4.27: https://developercommunity.visualstudio.com/t/vs2022-1710-internal-compiler-error-when-building-1/1677086
And it just works |
After reading the whole thread, I'm under impression that people get |
So, you could start another round of testing to see whether that patch actually fixes things. The proper solution is of course to fix crash on VS side. |
P.S. I merged this PR anyway because I believe that eventually VS crash will be fixed, and all changes that were done here make sense. |
Thanks @slonopotamus! There is an open PR to fix it in 5.0: https://github.com/EpicGames/UnrealEngine/pull/9043 I will try to apply it to UE 4.27 and see what happens either way. |
I just ran a build with latest .NET changes on VS2022 and got the same C#6 error. Did you run it with VS2022 or just with VS2019 and VS2017? |
I ran:
|
Rgr, thanks 👍 VS2022 + UE-4.27.2 seems to still have issues. Not sure I'll spend too much time on it, UE5 is ultimately the goal for VS2022 anyways. |
I've tried VS2022 + UE-4.27.2 and also observe C#6 error. Weird. I am completely out of ideas how to set up .NET in VS2022 Build Tools. |
|
That sounds like an issue in UE-4.27.2 as it doesn't happen in UE-5.0.1, maybe it's not an issue with our setup of .NET at all. |
C# 6 should work with .NET 4.6 (and older as well), but it's probably something in the UE environment that's pointing at an older compiler version, or an old MSBuild version is being picked up. Based on this blog post, a C# 5 compiler means we're using the C++-based compiler bundled with .NET Framework, not the Roslyn compiler which comes with Visual Studio 2015+ or can be installed into a project with NuGet. Poking around, perhaps we also need to install something like "C# and Visual Basic Roslyn compilers" ( So it might be as simple as adding the right path to Also worth noting that last time we saw this problem (VS2019 in 4.22) the fix was ensuring the right MSBuild was found. However, And apparently by "we" I mean April 2019 me... O_O |
Here is the diff to the Internal compiler error patch for VS2022. Same as in https://github.com/EpicGames/UnrealEngine/pull/9043. However it doesn't fix the missing .NET 4.5 in VS2022 Build Tools that Unreal Engine still requires. UE-5.0.2 will fix |
Tried building 5.1.0 using the following command: (other than visual-studio=2022 this should match the official Linux builds Adam does).
It failed eventually with the following:
I had this same problem locally on my PC and followed the instructions at https://dev.epicgames.com/community/learning/tutorials/k8Ve/unreal-engine-how-to-build-the-unreal-editor-github to install 4.5 as apparently this requires a special method as the vs-installer won't install it and the msi has gone from MS's website.
Doing this I was able to build locally, so this would need to be done inside the Containers when using VS 2022 too. |
The proper fix is this: https://github.com/EpicGames/UnrealEngine/commit/4c6166427c6fbc19b71684b48655e54b65b6b21a |
RunUAT will print the following message with 4.27.2 (and older), but it still works. UE 5.0 (presumably) updated that version check as they increment it with every release if there is a newer compatible VS version.
I also defaulted it to VS2019. VS2017 is pretty old and certain C++17 features are not well supported - this comes into play if you are building 3rd party things along with your Unreal project. Wanted to default to VS2022, but VS2019 feels safer at this time.
Minimal supported Unreal version for VS2022 might be higher, but I can't really test all older Unreal versions at this time. Since VS2019 to VS2022 generally worked without issue, I am assuming it is compatible to the same range of engines backwards as VS2019 is.
I didn't test the full build yet.
As a side note, RunUAT still needs to be used with
-VS2019
argument (eg.ue4 package -VS2019
) to pick up VS2022 and prevent it from complaining about missing VS2017. That is something that should be documented in ue4cli if this is confirmed working.