Add dacpac references to sqlproj with relative path (#14877)

* relative paths written to sqlproj, but can't delete yet

* only keep track of relative path

* remove leading slash

* add test

* use path.relative

* Add error message if dacpac reference is located on a different drive
This commit is contained in:
Kim Santiago
2021-03-30 17:06:04 -07:00
committed by GitHub
parent af4ad1fcb1
commit f4e1f85e0f
5 changed files with 87 additions and 1 deletions

View File

@@ -580,7 +580,10 @@ export class ProjectsController {
} else if ((<ISystemDatabaseReferenceSettings>settings).systemDb !== undefined) {
await project.addSystemDatabaseReference(<ISystemDatabaseReferenceSettings>settings);
} else {
await project.addDatabaseReference(<IDacpacReferenceSettings>settings);
// update dacpacFileLocation to relative path to project file
const dacpacRefSettings = settings as IDacpacReferenceSettings;
dacpacRefSettings.dacpacFileLocation = vscode.Uri.file(path.relative(project.projectFolderPath, dacpacRefSettings.dacpacFileLocation.fsPath));
await project.addDatabaseReference(dacpacRefSettings);
}
this.refreshProjectsTree(context);