From f96d8d8f2f1bab9a8d27601eca964219f1e86f64 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 19 Aug 2025 11:37:51 +1000 Subject: [PATCH 1/5] Pass C# design time targets path to build --- src/lsptoolshost/server/roslynLanguageServer.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lsptoolshost/server/roslynLanguageServer.ts b/src/lsptoolshost/server/roslynLanguageServer.ts index 1171b196a4..eb6989cae0 100644 --- a/src/lsptoolshost/server/roslynLanguageServer.ts +++ b/src/lsptoolshost/server/roslynLanguageServer.ts @@ -706,6 +706,15 @@ export class RoslynLanguageServer { // Set command enablement to use roslyn standalone commands. await vscode.commands.executeCommand('setContext', 'dotnet.server.activationContext', 'Roslyn'); _wasActivatedWithCSharpDevkit = false; + + if (razorOptions.cohostingEnabled) { + // Razor has code in Microsoft.CSharp.DesignTime.targets to handle non-Razor-SDK projects, but that doesn't get imported outside + // of DevKit so we polyfill with a mini-version that Razor provides for that scenario. + args.push( + '--csharpDesignTimePath', + path.join(razorComponentPath, 'Targets', 'Microsoft.CSharpExtension.DesignTime.targets') + ); + } } for (const extensionPath of additionalExtensionPaths) { From f1ee78d6f9bd8bfeb0e412e9698f2420a33516b6 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 19 Aug 2025 11:56:47 +1000 Subject: [PATCH 2/5] Reference Razor design time targets from the extension if cohosting is on --- src/lsptoolshost/server/roslynLanguageServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lsptoolshost/server/roslynLanguageServer.ts b/src/lsptoolshost/server/roslynLanguageServer.ts index eb6989cae0..8d1951d1f4 100644 --- a/src/lsptoolshost/server/roslynLanguageServer.ts +++ b/src/lsptoolshost/server/roslynLanguageServer.ts @@ -666,7 +666,7 @@ export class RoslynLanguageServer { args.push( '--razorDesignTimePath', - path.join(razorPath, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets') + path.join(razorSourceGeneratorPath, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets') ); // Get the brokered service pipe name from C# Dev Kit (if installed). From b6cdecf3ae203c9dad7093ee44e0681e0158f539 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 25 Aug 2025 13:06:03 +1000 Subject: [PATCH 3/5] Bump Razor to 10.0.0-preview.25424.9 --- CHANGELOG.md | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a6e567854..e68d4fcebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) # 2.90.x -* Bump Razor to 10.0.0-preview.25416.1 (PR: [#8557](https://github.com/dotnet/vscode-csharp/pull/8557)) +* Bump Razor to 10.0.0-preview.25424.9 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559)) + * Allow Razor cohosting to work with non-Razor SDK projects (PR: [#12118](https://github.com/dotnet/razor/pull/12118)) + * Allow the source generator to produce results for miscellaneous files (PR: [#12106](https://github.com/dotnet/razor/pull/12106)) * Fix range formatting in the presence of K&R braces (PR: [#12121](https://github.com/dotnet/razor/pull/12121)) * Add codelens endpoints and services for cohosting (PR: [#12078](https://github.com/dotnet/razor/pull/12078)) * Support Go To Def for Mvc tag helpers in cohosting (PR: [#12102](https://github.com/dotnet/razor/pull/12102)) diff --git a/package.json b/package.json index 7ef1eab978..6d53f502e7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "defaults": { "roslyn": "5.0.0-2.25412.5", "omniSharp": "1.39.14", - "razor": "10.0.0-preview.25419.3", + "razor": "10.0.0-preview.25424.9", "razorOmnisharp": "7.0.0-preview.23363.1", "xamlTools": "17.14.36106.43" }, From 8a4c29ddf0768aa6ac4129d97f66ae32f3a825cc Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 25 Aug 2025 13:13:06 +1000 Subject: [PATCH 4/5] Bump Roslyn to 5.0.0-2.25424.1 --- CHANGELOG.md | 11 +++++++++++ package.json | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e68d4fcebb..0e2a6d7db3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) # 2.90.x +* Bump Roslyn to 5.0.0-2.25424.1 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559)) + * Don't cache known-broken compositions (PR: [#80021](https://github.com/dotnet/roslyn/pull/80021)) + * Generate `init` accessor for required properties inside `readonly struct`s (PR: [#80004](https://github.com/dotnet/roslyn/pull/80004)) + * Allow Razor cohosting to work with non-Razor SDK projects (PR: [#79953](https://github.com/dotnet/roslyn/pull/79953)) + * Update 'use expr body' to be a purely syntactic analyzer (PR: [#79979](https://github.com/dotnet/roslyn/pull/79979)) + * ResxSourceGenerator: Added XML comment summary to the generated classes and properties to avoid warning CS1591 if they are public (PR: [#79940](https://github.com/dotnet/roslyn/pull/79940)) + * Implement "Simplify property accessor" feature (PR: [#79754](https://github.com/dotnet/roslyn/pull/79754)) + * ResxSourceGenerator: Changed the access modifier of the generated format methods from "internal" to "public" as it is with the generated properties. (PR: [#79941](https://github.com/dotnet/roslyn/pull/79941)) + * Allow Razor to hook up the source generator in misc files (PR: [#79891](https://github.com/dotnet/roslyn/pull/79891)) + * Block ENC for extension blocks (PR: [#79883](https://github.com/dotnet/roslyn/pull/79883)) + * Fix ref safety of implicit calls that might capture refs in the receiver (PR: [#76657](https://github.com/dotnet/roslyn/pull/76657)) * Bump Razor to 10.0.0-preview.25424.9 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559)) * Allow Razor cohosting to work with non-Razor SDK projects (PR: [#12118](https://github.com/dotnet/razor/pull/12118)) * Allow the source generator to produce results for miscellaneous files (PR: [#12106](https://github.com/dotnet/razor/pull/12106)) diff --git a/package.json b/package.json index 6d53f502e7..c96baf7055 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "workspace" ], "defaults": { - "roslyn": "5.0.0-2.25412.5", - "omniSharp": "1.39.14", + "roslyn": "5.0.0-2.25424.1", + "omniSharp": "1.39.14", "razor": "10.0.0-preview.25424.9", "razorOmnisharp": "7.0.0-preview.23363.1", "xamlTools": "17.14.36106.43" From 6eee9427c0c4f6a06c5d4cad2bed3d85b9e36e4e Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 26 Aug 2025 09:04:19 +1000 Subject: [PATCH 5/5] Update CHANGELOG.md Co-authored-by: Joey Robichaud --- CHANGELOG.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e2a6d7db3..d0929dbf04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,16 +5,11 @@ # 2.90.x * Bump Roslyn to 5.0.0-2.25424.1 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559)) - * Don't cache known-broken compositions (PR: [#80021](https://github.com/dotnet/roslyn/pull/80021)) * Generate `init` accessor for required properties inside `readonly struct`s (PR: [#80004](https://github.com/dotnet/roslyn/pull/80004)) * Allow Razor cohosting to work with non-Razor SDK projects (PR: [#79953](https://github.com/dotnet/roslyn/pull/79953)) - * Update 'use expr body' to be a purely syntactic analyzer (PR: [#79979](https://github.com/dotnet/roslyn/pull/79979)) - * ResxSourceGenerator: Added XML comment summary to the generated classes and properties to avoid warning CS1591 if they are public (PR: [#79940](https://github.com/dotnet/roslyn/pull/79940)) - * Implement "Simplify property accessor" feature (PR: [#79754](https://github.com/dotnet/roslyn/pull/79754)) - * ResxSourceGenerator: Changed the access modifier of the generated format methods from "internal" to "public" as it is with the generated properties. (PR: [#79941](https://github.com/dotnet/roslyn/pull/79941)) + * Update 'use expr body' to be a purely syntactic analyzer (PR: [#79979](https://github.com/dotnet/roslyn/pull/79979)) + * Implement "Simplify property accessor" feature (PR: [#79754](https://github.com/dotnet/roslyn/pull/79754)) * Allow Razor to hook up the source generator in misc files (PR: [#79891](https://github.com/dotnet/roslyn/pull/79891)) - * Block ENC for extension blocks (PR: [#79883](https://github.com/dotnet/roslyn/pull/79883)) - * Fix ref safety of implicit calls that might capture refs in the receiver (PR: [#76657](https://github.com/dotnet/roslyn/pull/76657)) * Bump Razor to 10.0.0-preview.25424.9 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559)) * Allow Razor cohosting to work with non-Razor SDK projects (PR: [#12118](https://github.com/dotnet/razor/pull/12118)) * Allow the source generator to produce results for miscellaneous files (PR: [#12106](https://github.com/dotnet/razor/pull/12106))