mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Fix "unsupported version" error when adding sql binding package (#17721)
This commit is contained in:
@@ -44,18 +44,22 @@ export class NetCoreTool extends ShellExecutionHelper {
|
||||
|
||||
/**
|
||||
* This method presents the installation dialog for .NET Core, if not already present/supported
|
||||
* @param skipVersionSupportedCheck If true then skip the check to determine whether the .NET version is supported (for commands that work on all versions)
|
||||
* @returns True if .NET version was found and is supported
|
||||
* False if .NET version isn't present or present but not supported
|
||||
*/
|
||||
public async findOrInstallNetCore(): Promise<boolean> {
|
||||
if ((!this.isNetCoreInstallationPresent || !await this.isNetCoreVersionSupported())) {
|
||||
if (this.netCoreInstallState === netCoreInstallState.netCoreVersionSupported && vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDoNotAskAgainKey] !== true) {
|
||||
void this.showInstallDialog(); // Removing await so that Build and extension load process doesn't wait on user input
|
||||
} else if (this.netCoreInstallState === netCoreInstallState.netCoreVersionTooHigh && vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDowngradeDoNotShowAgainKey] !== true) {
|
||||
void this.showDowngradeDialog();
|
||||
public async findOrInstallNetCore(skipVersionSupportedCheck = false): Promise<boolean> {
|
||||
if (!this.isNetCoreInstallationPresent || (this.isNetCoreInstallationPresent && !skipVersionSupportedCheck)) {
|
||||
if (!this.isNetCoreInstallationPresent || !await this.isNetCoreVersionSupported()) {
|
||||
if (this.netCoreInstallState === netCoreInstallState.netCoreVersionSupported && vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDoNotAskAgainKey] !== true) {
|
||||
void this.showInstallDialog(); // Removing await so that Build and extension load process doesn't wait on user input
|
||||
} else if (this.netCoreInstallState === netCoreInstallState.netCoreVersionTooHigh && vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDowngradeDoNotShowAgainKey] !== true) {
|
||||
void this.showDowngradeDialog();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.netCoreInstallState = netCoreInstallState.netCoreVersionSupported;
|
||||
return true;
|
||||
}
|
||||
@@ -197,12 +201,18 @@ export class NetCoreTool extends ShellExecutionHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public async runDotnetCommand(options: ShellCommandOptions): Promise<string> {
|
||||
/**
|
||||
* Runs the specified dotnet command
|
||||
* @param options The options to use when launching the process
|
||||
* @param skipVersionSupportedCheck If true then skip the check to determine whether the .NET version is supported (for commands that work on all versions)
|
||||
* @returns
|
||||
*/
|
||||
public async runDotnetCommand(options: ShellCommandOptions, skipVersionSupportedCheck = false): Promise<string> {
|
||||
if (options && options.commandTitle !== undefined && options.commandTitle !== null) {
|
||||
this._outputChannel.appendLine(`\t[ ${options.commandTitle} ]`);
|
||||
}
|
||||
|
||||
if (!(await this.findOrInstallNetCore())) {
|
||||
if (!(await this.findOrInstallNetCore(skipVersionSupportedCheck))) {
|
||||
if (this.netCoreInstallState === netCoreInstallState.netCoreNotPresent) {
|
||||
throw new DotNetError(NetCoreInstallationConfirmation);
|
||||
} else if (this.netCoreInstallState === netCoreInstallState.netCoreVersionTooHigh && vscode.workspace.getConfiguration(DBProjectConfigurationKey)[NetCoreDowngradeDoNotShowAgainKey] === true) {
|
||||
|
||||
@@ -47,8 +47,8 @@ export class PackageHelper {
|
||||
commandTitle: constants.addPackage,
|
||||
argument: this.constructAddPackageArguments(projectUri, packageName, packageVersion)
|
||||
};
|
||||
|
||||
await this.netCoreTool.runDotnetCommand(addOptions);
|
||||
// Add package can be done with any version of .NET so skip the supported version check
|
||||
await this.netCoreTool.runDotnetCommand(addOptions, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user