-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Check to see if the .NET 6.0 SDK is Installed When Launching Stride #1809
Conversation
- Check to see if the required .NET SDK is installed for Stride 4.1, otherwise the engine can be launched with an incompatible SDK (i.e., .NET 5)
Given the fact that we'll be upgrading to .Net 8 shortly, we'll have to remember to change this scope as well. How about we future proof it. Checking for an available SDK of the .net version the game studio is built in instead of net6 explicitly ? |
That's a good idea! Is there a way to programmatically check which version of .net an application was built with? |
Well, I thought that your |
Hmm, the .NET SDK now includes the Runtime so that shouldn't be an issue moving forward, but I wasn't thinking of the Runtime as a standalone install. I guess we need some additional checks. 🤔 |
I was thinking FindAndSetMSBuildVersion() is deprecated now that only the .NET SDK is supported but we can simply raise x.Version.Major value here for a similar result,
I'll update the PR if there are no objections, this method still relies on RuntimeInformation.FrameworkDescription so @Eideren's point is valid. |
So, checking that version against Environment.Version then ? |
From my tests so far I think we can leave it as is because x.Version.Major needs to be updated manually regardless. We also need an exact version match with whatever that version is. |
- Reverted prior changes, raised version check number in FindAndSetMSBuildVersion - Updated MSBuild exception message to provide additional info
Updated PR and post. Now that the .NET SDK includes the Runtime I think this will still help many users avoid issues with out of date SDKs moving forward (and I assume x.Version.Major was meant to remain current anyway). |
@@ -234,6 +234,7 @@ private static async void Startup(UFile initialSessionPath) | |||
var message = "Could not find a compatible version of MSBuild.\r\n\r\n" + | |||
"Check that you have a valid installation with the required workloads, or go to [www.visualstudio.com/downloads](https://www.visualstudio.com/downloads) to install a new one.\r\n" + | |||
"Also make sure you have the latest [.NET 6 SDK](https://dotnet.microsoft.com/) \r\n\r\n" + | |||
"Detected SDK: " + RuntimeInformation.FrameworkDescription.ToString() + "\r\n\r\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still the runtime version though, not the sdk, right ? And I think it might be the runtime that the application is under, not the one installed. So if the gamestudio is self contained, which might be the case (?), this'll always report net6 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you're right, good catch! I've removed that addition, the change in FindAndSetMSBuildVersion() still works as intended. You can test this by uninstalling the .NET 6 SDK and running a previously built version of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gamestudio is self contained
I'm not sure that is the case. Looking at the contents of Stride.GameStudio
NuGet package it is built as runtime dependent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gamestudio is self contained
I'm not sure that is the case. Looking at the contents of
Stride.GameStudio
NuGet package it is built as runtime dependent.
Hmm, when I tested before the final PR update the "Detected SDK" was still reporting .NET 6.0 despite the SDK/runtime being uninstalled. MSBuildLocator on the other hand did pick up that the SDK was missing.
Thanks ! |
PR Details
Stride 4.1 requires the .NET 6.0 SDK. The existing FindAndSetMSBuildVersion() method can be bypassed if an older version of the SDK is installed (i.e., 5.0) because the method is checking for .NET Core 3 or above.
After bypassing this prerequisite check, Stride will function normally until the user attempts to build their project.
Description
The x.Version.Major requirement was raised in Stride.Core.Assets\PackageSessionPublicHelper.cs, the check is performed when the user opens Stride 4.1.x. If the SDK is missing the user is prompted to install it, the detected SDK version is provided to help with troubleshooting.
Related Issue
Prompted by discussion in issue #1753
Types of changes
Checklist