diff --git a/sources/assets/Stride.Core.Packages/Stride.Core.Packages.csproj b/sources/assets/Stride.Core.Packages/Stride.Core.Packages.csproj index 20c30b71a3..ea26ac5e90 100644 --- a/sources/assets/Stride.Core.Packages/Stride.Core.Packages.csproj +++ b/sources/assets/Stride.Core.Packages/Stride.Core.Packages.csproj @@ -7,10 +7,10 @@ --auto-module-initializer --serialization - - - - + + + + diff --git a/sources/core/Stride.Core.Design/Stride.Core.Design.csproj b/sources/core/Stride.Core.Design/Stride.Core.Design.csproj index ba6ddde0f1..d356eed87d 100644 --- a/sources/core/Stride.Core.Design/Stride.Core.Design.csproj +++ b/sources/core/Stride.Core.Design/Stride.Core.Design.csproj @@ -25,7 +25,7 @@ - + diff --git a/sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs b/sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs index f80631c26e..6aab5d954c 100644 --- a/sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs +++ b/sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs @@ -22,6 +22,7 @@ using Stride.Core.Extensions; using Stride.Assets.Presentation.AssetEditors.ScriptEditor; using Project = Microsoft.CodeAnalysis.Project; +using System.Diagnostics; namespace Stride.Assets.Presentation.AssetEditors { @@ -354,8 +355,6 @@ private async Task OpenProject(UFile projectPath) { if (msbuildWorkspace == null) { - // Only load workspace for C# assemblies (default includes VB but not added as a NuGet package) - //var csharpWorkspaceAssemblies = new[] { Assembly.Load("Microsoft.CodeAnalysis.Workspaces"), Assembly.Load("Microsoft.CodeAnalysis.CSharp.Workspaces"), Assembly.Load("Microsoft.CodeAnalysis.Workspaces.Desktop") }; var host = await RoslynHost; msbuildWorkspace = MSBuildWorkspace.Create(ImmutableDictionary.Empty, host.HostServices); } @@ -370,43 +369,13 @@ private async Task OpenProject(UFile projectPath) { var project = await msbuildWorkspace.OpenProjectAsync(projectPath.ToWindowsPath()); - // Change the default CSharp language version to match the supported version for a specific visual studio version or MSBuild version - // this is because roslyn will always resolve Default to Latest which might not match the - // latest version supported by the build tools installed on the machine - var csharpParseOptions = project.ParseOptions as CSharpParseOptions; - if (csharpParseOptions != null) + if (msbuildWorkspace.Diagnostics.Count > 0) { - if (csharpParseOptions.SpecifiedLanguageVersion == LanguageVersion.Default || csharpParseOptions.SpecifiedLanguageVersion == LanguageVersion.Latest) - { - LanguageVersion targetLanguageVersion = csharpParseOptions.SpecifiedLanguageVersion; - - // Check the visual studio version inside the solution first, which is what visual studio uses to decide which version to open - // this should not be confused with the toolsVersion below, since this is the MSBuild version (they might be different) - Version visualStudioVersion = session.CurrentProject?.Package.Session.VisualStudioVersion; - if (visualStudioVersion != null) - { - if (visualStudioVersion.Major <= 14) - { - targetLanguageVersion = LanguageVersion.CSharp6; - } - - } - else - { - // Fallback to checking the tools version on the csproj - // this happens when you open an sdpkg instead of a sln file as a project - ProjectRootElement xml = ProjectRootElement.Open(projectPath); - Version toolsVersion; - if (Version.TryParse(xml.ToolsVersion, out toolsVersion)) - { - if (toolsVersion.Major <= 14) - { - targetLanguageVersion = LanguageVersion.CSharp6; - } - } - } - project = project.WithParseOptions(csharpParseOptions.WithLanguageVersion(targetLanguageVersion)); - } + // There was an issue compiling the project + // at the moment there's no mechanism to surface those errors to the UI, so leaving this in here: + //if (Debugger.IsAttached) Debugger.Break(); + foreach (var diagnostic in msbuildWorkspace.Diagnostics) + Debug.WriteLine(diagnostic.Message, category: nameof(ProjectWatcher)); } return project; } diff --git a/sources/tools/Stride.NuGetLoader/Stride.NuGetLoader.csproj b/sources/tools/Stride.NuGetLoader/Stride.NuGetLoader.csproj index 4f895bf1b1..c36d61c073 100644 --- a/sources/tools/Stride.NuGetLoader/Stride.NuGetLoader.csproj +++ b/sources/tools/Stride.NuGetLoader/Stride.NuGetLoader.csproj @@ -1,4 +1,4 @@ - + @@ -17,9 +17,9 @@ - - - + + + diff --git a/sources/tools/Stride.VisualStudio.Package/Stride.VisualStudio.Package.csproj b/sources/tools/Stride.VisualStudio.Package/Stride.VisualStudio.Package.csproj index e5f0515565..83a1f3693e 100644 --- a/sources/tools/Stride.VisualStudio.Package/Stride.VisualStudio.Package.csproj +++ b/sources/tools/Stride.VisualStudio.Package/Stride.VisualStudio.Package.csproj @@ -34,7 +34,7 @@ - +