microsoft/vscode · error · Error

Failed to check for .NET version using '${this.dotnet.comman

Error message

Failed to check for .NET version using '${this.dotnet.command} --version'.

What it means

Error "Failed to check for .NET version using '${this.dotnet.command} --version'." thrown in microsoft/vscode.

Source

Thrown at extensions/copilot/src/extension/mcp/vscode-node/nuget.ts:167

		} finally {
			try {
				await fs.rm(installDir, { recursive: true, force: true });
			} catch (e) {
				this.logService.warn(`Failed to clean up temporary .NET tool install directory ${installDir}.
Error: ${e}`);
			}
		}
	}

	async getDotnetVersion(cwd: string): Promise<string> {
		const args = this.dotnet.args.concat(['--version']);
		const result = await this.commandExecutor.executeWithTimeout(this.dotnet.command, args, cwd);
		const version = result.stdout.trim();
		if (result.exitCode !== 0 || !version) {
			this.logService.warn(`Failed to check for .NET version while checking if a NuGet MCP server exists.
stdout: ${result.stdout}
stderr: ${result.stderr}`);
			throw new Error(`Failed to check for .NET version using '${this.dotnet.command} --version'.`);
		}

		return version;
	}

	async getLatestPackageVersion(cwd: string, id: string): Promise<{ id: string; version: string; owners?: string } | undefined> {
		// we don't use --exact-match here because it does not return owner information on NuGet.org
		const args = this.dotnet.args.concat(['package', 'search', id, '--source', this.source, '--prerelease', '--format', 'json']);
		const searchResult = await this.commandExecutor.executeWithTimeout(this.dotnet.command, args, cwd);
		const searchData: DotnetPackageSearchOutput = JSON.parse(searchResult.stdout.trim());
		for (const result of searchData.searchResult ?? []) {
			for (const pkg of result.packages ?? []) {
				if (pkg.id.toUpperCase() === id.toUpperCase()) {
					return { id: pkg.id, version: pkg.latestVersion, owners: pkg.owners };
				}
			}
		}
	}

View on GitHub (pinned to a94b963a32)

When it happens

Trigger: Thrown at extensions/copilot/src/extension/mcp/vscode-node/nuget.ts:167 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/vscode@a94b963a32 (2026-08-12). Data as JSON: /api/errors/e05184d9dd9ed304. Report an issue: GitHub.