From 601d1dedcb1a682012800846175d7b26a9007f3b Mon Sep 17 00:00:00 2001 From: Doprez <73259914+Doprez@users.noreply.github.com> Date: Sat, 15 Jun 2024 10:35:56 -0600 Subject: [PATCH 1/4] .NET 6 reference missed --- sources/editor/Stride.GameStudio/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/editor/Stride.GameStudio/Program.cs b/sources/editor/Stride.GameStudio/Program.cs index dcf28c06e5..38febbe7d5 100644 --- a/sources/editor/Stride.GameStudio/Program.cs +++ b/sources/editor/Stride.GameStudio/Program.cs @@ -224,7 +224,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" + + "Also make sure you have the latest [.NET 8 SDK](https://dotnet.microsoft.com/) \r\n\r\n" + e; await serviceProvider.Get().MessageBoxAsync(message, Core.Presentation.Services.MessageBoxButton.OK, Core.Presentation.Services.MessageBoxImage.Error); app.Shutdown(); From 62d9708882f1716d16286d91a2ec024e72a8c4fe Mon Sep 17 00:00:00 2001 From: Doprez <73259914+Doprez@users.noreply.github.com> Date: Sat, 15 Jun 2024 15:31:43 -0600 Subject: [PATCH 2/4] added central version number from Jkao for better consistancy --- .../Stride.Core.Assets/PackageSessionPublicHelper.cs | 7 +++++-- sources/editor/Stride.GameStudio/Program.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs index 26990490ec..6fb3a81057 100644 --- a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs +++ b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs @@ -16,6 +16,9 @@ namespace Stride.Core.Assets /// public static class PackageSessionPublicHelper { + + public const byte NetMajorVersion = 8; //or NET_MAJOR_VERSION + private static readonly string[] s_msBuildAssemblies = { "Microsoft.Build", @@ -38,13 +41,13 @@ public static void FindAndSetMSBuildVersion() // Detect either .NET Core SDK or Visual Studio depending on current runtime var isNETCore = !RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal); MSBuildInstance = MSBuildLocator.QueryVisualStudioInstances().FirstOrDefault(x => isNETCore - ? x.DiscoveryType == DiscoveryType.DotNetSdk && x.Version.Major == 8 + ? x.DiscoveryType == DiscoveryType.DotNetSdk && x.Version.Major == NetMajorVersion : (x.DiscoveryType == DiscoveryType.VisualStudioSetup || x.DiscoveryType == DiscoveryType.DeveloperConsole) && x.Version.Major >= 16); if (MSBuildInstance == null) { throw new InvalidOperationException("Could not find a MSBuild installation (expected 16.0 or later) " + - "Please ensure you have the .NET 8 SDK installed from Microsoft's website"); + $"Please ensure you have the .NET {NetMajorVersion} SDK installed from Microsoft's website"); } // Make sure it is not already loaded (otherwise MSBuildLocator.RegisterDefaults() throws an exception) diff --git a/sources/editor/Stride.GameStudio/Program.cs b/sources/editor/Stride.GameStudio/Program.cs index 38febbe7d5..6f82d46547 100644 --- a/sources/editor/Stride.GameStudio/Program.cs +++ b/sources/editor/Stride.GameStudio/Program.cs @@ -224,7 +224,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 8 SDK](https://dotnet.microsoft.com/) \r\n\r\n" + + $"Also make sure you have the latest [.NET {PackageSessionPublicHelper.NetMajorVersion} SDK](https://dotnet.microsoft.com/) \r\n\r\n" + e; await serviceProvider.Get().MessageBoxAsync(message, Core.Presentation.Services.MessageBoxButton.OK, Core.Presentation.Services.MessageBoxImage.Error); app.Shutdown(); From a7b5d7521b80ad2a9cd4ebf8a22ccac4dfbb5125 Mon Sep 17 00:00:00 2001 From: Doprez <73259914+Doprez@users.noreply.github.com> Date: Sat, 15 Jun 2024 15:53:43 -0600 Subject: [PATCH 3/4] updated comment --- .../assets/Stride.Core.Assets/PackageSessionPublicHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs index 6fb3a81057..23a08b55c0 100644 --- a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs +++ b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs @@ -17,7 +17,10 @@ namespace Stride.Core.Assets public static class PackageSessionPublicHelper { - public const byte NetMajorVersion = 8; //or NET_MAJOR_VERSION + /// + /// The current major .NET version that Stride will use. + /// + public const byte NetMajorVersion = 8; private static readonly string[] s_msBuildAssemblies = { From 293063c5e113784caa2f12445ac326df2fd656aa Mon Sep 17 00:00:00 2001 From: Doprez <73259914+Doprez@users.noreply.github.com> Date: Mon, 17 Jun 2024 07:18:53 -0600 Subject: [PATCH 4/4] Get version from Environment --- sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs index 23a08b55c0..8b8bff382f 100644 --- a/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs +++ b/sources/assets/Stride.Core.Assets/PackageSessionPublicHelper.cs @@ -20,7 +20,7 @@ public static class PackageSessionPublicHelper /// /// The current major .NET version that Stride will use. /// - public const byte NetMajorVersion = 8; + public static int NetMajorVersion => Environment.Version.Major; private static readonly string[] s_msBuildAssemblies = {