@@ -22,6 +22,10 @@ export const DotNetRuntimeVersion = '8.0.10';
22
22
export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
23
23
constructor (
24
24
private platformInfo : PlatformInformation ,
25
+ /**
26
+ * This is a function instead of a string because the server path can change while the extension is active (when the option changes).
27
+ */
28
+ private getServerPath : ( platform : PlatformInformation ) => string ,
25
29
private channel : vscode . OutputChannel ,
26
30
private extensionPath : string
27
31
) { }
@@ -57,7 +61,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
57
61
this . channel . appendLine (
58
62
`Did not find .NET ${ DotNetRuntimeVersion } on path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime`
59
63
) ;
60
- acquireResult = await this . acquireRuntime ( ) ;
64
+ acquireResult = await this . acquireDotNetProcessDependencies ( ) ;
61
65
}
62
66
63
67
dotnetExecutablePath = acquireResult . dotnetPath ;
@@ -119,6 +123,23 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
119
123
return status ;
120
124
}
121
125
126
+ /**
127
+ * Acquires the .NET runtime and any other dependencies required to spawn a particular .NET executable.
128
+ * @param path The path to the entrypoint assembly. Typically a .dll.
129
+ */
130
+ private async acquireDotNetProcessDependencies ( ) : Promise < IDotnetAcquireResult > {
131
+ const acquireResult = await this . acquireRuntime ( ) ;
132
+
133
+ const args = [ this . getServerPath ( this . platformInfo ) ] ;
134
+ // This will install any missing Linux dependencies.
135
+ await vscode . commands . executeCommand ( 'dotnet.ensureDotnetDependencies' , {
136
+ command : acquireResult . dotnetPath ,
137
+ arguments : args ,
138
+ } ) ;
139
+
140
+ return acquireResult ;
141
+ }
142
+
122
143
private async getArchitectureFromTargetPlatform ( ) : Promise < string | undefined > {
123
144
const vsixManifestFile = path . join ( this . extensionPath , '.vsixmanifest' ) ;
124
145
if ( ! existsSync ( vsixManifestFile ) ) {
0 commit comments