mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Ensure SQL Nuget package reference is always updating to latest (#20390)
* seperate nuget package references to always update to latest * nit * nit comments
This commit is contained in:
@@ -196,13 +196,13 @@ export async function getSettingsFile(projectFolder: string): Promise<string | u
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the required nuget package to the project
|
||||
* @param selectedProjectFile is the users selected project file path
|
||||
* Adds the latest SQL nuget package to the project
|
||||
* @param projectFolder is the folder containing the project file
|
||||
*/
|
||||
export async function addSqlNugetReferenceToProjectFile(selectedProjectFile: string): Promise<void> {
|
||||
export async function addSqlNugetReferenceToProjectFile(projectFolder: string): Promise<void> {
|
||||
// clear the output channel prior to adding the nuget reference
|
||||
outputChannel.clear();
|
||||
let addNugetCommmand = await utils.executeCommand(`dotnet add "${selectedProjectFile}" package ${constants.sqlExtensionPackageName} --prerelease`);
|
||||
let addNugetCommmand = await utils.executeCommand(`dotnet add "${projectFolder}" package ${constants.sqlExtensionPackageName} --prerelease`);
|
||||
outputChannel.appendLine(constants.dotnetResult(addNugetCommmand));
|
||||
outputChannel.show(true);
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.addSQLNugetPackage);
|
||||
@@ -477,8 +477,6 @@ export async function promptAndUpdateConnectionStringSetting(projectUri: vscode.
|
||||
connectionStringSettingName = selectedSetting?.label;
|
||||
}
|
||||
}
|
||||
// Add sql extension package reference to project. If the reference is already there, it doesn't get added again
|
||||
await addSqlNugetReferenceToProjectFile(projectUri.fsPath);
|
||||
} else {
|
||||
// if no AF project was found or there's more than one AF functions project in the workspace,
|
||||
// ask for the user to input the setting name
|
||||
|
||||
@@ -7,6 +7,7 @@ import * as vscode from 'vscode';
|
||||
import * as uuid from 'uuid';
|
||||
import * as constants from '../common/constants';
|
||||
import * as utils from '../common/utils';
|
||||
import * as path from 'path';
|
||||
import * as azureFunctionsUtils from '../common/azureFunctionsUtils';
|
||||
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
|
||||
import { addSqlBinding, getAzureFunctions } from '../services/azureFunctionsService';
|
||||
@@ -113,6 +114,13 @@ export async function launchAddSqlBindingQuickpick(uri: vscode.Uri | undefined):
|
||||
.withAdditionalProperties(propertyBag).send();
|
||||
return;
|
||||
}
|
||||
|
||||
// Add latest sql extension package reference to project
|
||||
// only add if AF project (.csproj) is found
|
||||
if (projectUri?.fsPath) {
|
||||
await azureFunctionsUtils.addSqlNugetReferenceToProjectFile(path.dirname(projectUri.fsPath));
|
||||
}
|
||||
|
||||
exitReason = 'done';
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.SqlBindingsQuickPick, TelemetryActions.finishAddSqlBinding)
|
||||
.withAdditionalProperties(propertyBag).send();
|
||||
|
||||
@@ -255,6 +255,10 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
|
||||
suppressCreateProjectPrompt: true,
|
||||
...(isCreateNewProject && { executeStep: connectionStringExecuteStep })
|
||||
});
|
||||
|
||||
// Add latest sql extension package reference to project
|
||||
await azureFunctionsUtils.addSqlNugetReferenceToProjectFile(projectFolder);
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, telemetryStep)
|
||||
.withAdditionalProperties(propertyBag)
|
||||
.withConnectionInfo(connectionInfo).send();
|
||||
|
||||
Reference in New Issue
Block a user