Skip to content

Commit a11b972

Browse files
authored
Allow Razor cohosting to work with non-Razor SDK projects (#8559)
2 parents 4ca4cf4 + 6eee942 commit a11b972

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
55

66
# 2.90.x
7-
* Bump Razor to 10.0.0-preview.25416.1 (PR: [#8557](https://github.com/dotnet/vscode-csharp/pull/8557))
7+
* Bump Roslyn to 5.0.0-2.25424.1 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559))
8+
* Generate `init` accessor for required properties inside `readonly struct`s (PR: [#80004](https://github.com/dotnet/roslyn/pull/80004))
9+
* Allow Razor cohosting to work with non-Razor SDK projects (PR: [#79953](https://github.com/dotnet/roslyn/pull/79953))
10+
* Update 'use expr body' to be a purely syntactic analyzer (PR: [#79979](https://github.com/dotnet/roslyn/pull/79979))
11+
* Implement "Simplify property accessor" feature (PR: [#79754](https://github.com/dotnet/roslyn/pull/79754))
12+
* Allow Razor to hook up the source generator in misc files (PR: [#79891](https://github.com/dotnet/roslyn/pull/79891))
13+
* Bump Razor to 10.0.0-preview.25424.9 (PR: [#8559](https://github.com/dotnet/vscode-csharp/pull/8559))
14+
* Allow Razor cohosting to work with non-Razor SDK projects (PR: [#12118](https://github.com/dotnet/razor/pull/12118))
15+
* Allow the source generator to produce results for miscellaneous files (PR: [#12106](https://github.com/dotnet/razor/pull/12106))
816
* Fix range formatting in the presence of K&R braces (PR: [#12121](https://github.com/dotnet/razor/pull/12121))
917
* Add codelens endpoints and services for cohosting (PR: [#12078](https://github.com/dotnet/razor/pull/12078))
1018
* Support Go To Def for Mvc tag helpers in cohosting (PR: [#12102](https://github.com/dotnet/razor/pull/12102))

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
"workspace"
4141
],
4242
"defaults": {
43-
"roslyn": "5.0.0-2.25412.5",
44-
"omniSharp": "1.39.14",
45-
"razor": "10.0.0-preview.25419.3",
43+
"roslyn": "5.0.0-2.25424.1",
44+
"omniSharp": "1.39.14",
45+
"razor": "10.0.0-preview.25424.9",
4646
"razorOmnisharp": "7.0.0-preview.23363.1",
4747
"xamlTools": "17.14.36106.43"
4848
},

src/lsptoolshost/server/roslynLanguageServer.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ export class RoslynLanguageServer {
666666

667667
args.push(
668668
'--razorDesignTimePath',
669-
path.join(razorPath, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets')
669+
path.join(razorSourceGeneratorPath, 'Targets', 'Microsoft.NET.Sdk.Razor.DesignTime.targets')
670670
);
671671

672672
// Get the brokered service pipe name from C# Dev Kit (if installed).
@@ -706,6 +706,15 @@ export class RoslynLanguageServer {
706706
// Set command enablement to use roslyn standalone commands.
707707
await vscode.commands.executeCommand('setContext', 'dotnet.server.activationContext', 'Roslyn');
708708
_wasActivatedWithCSharpDevkit = false;
709+
710+
if (razorOptions.cohostingEnabled) {
711+
// Razor has code in Microsoft.CSharp.DesignTime.targets to handle non-Razor-SDK projects, but that doesn't get imported outside
712+
// of DevKit so we polyfill with a mini-version that Razor provides for that scenario.
713+
args.push(
714+
'--csharpDesignTimePath',
715+
path.join(razorComponentPath, 'Targets', 'Microsoft.CSharpExtension.DesignTime.targets')
716+
);
717+
}
709718
}
710719

711720
for (const extensionPath of additionalExtensionPaths) {

0 commit comments

Comments
 (0)