fix pre/post deploy scripts getting double counted in the files for sdk style projects (#17954)

* fix pre/post deploy scripts getting double counted in the files for sdk style projects

* add test

* update comment
This commit is contained in:
Kim Santiago
2021-12-16 15:32:32 -08:00
committed by GitHub
parent 6f3a68bf68
commit b6d38e6e58
4 changed files with 58 additions and 8 deletions

View File

@@ -122,13 +122,15 @@ export class Project implements ISqlProject {
// check if this is an sdk style project https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview
this._isSdkStyleProject = this.CheckForSdkStyleProject();
// get pre and post deploy scripts specified in the sqlproj
this._preDeployScripts = this.readPreDeployScripts();
this._postDeployScripts = this.readPostDeployScripts();
this._noneDeployScripts = this.readNoneDeployScripts();
// get files and folders
this._files = await this.readFilesInProject();
this.files.push(...await this.readFolders());
this._preDeployScripts = this.readPreDeployScripts();
this._postDeployScripts = this.readPostDeployScripts();
this._noneDeployScripts = this.readNoneDeployScripts();
this._databaseReferences = this.readDatabaseReferences();
this._importedTargets = this.readImportedTargets();
@@ -225,6 +227,13 @@ export class Project implements ISqlProject {
}
}
if (this.isSdkStyleProject) {
// remove any pre/post/none deploy scripts that were specified in the sqlproj so they aren't counted twice
this.preDeployScripts.forEach(f => filesSet.delete(f.relativePath));
this.postDeployScripts.forEach(f => filesSet.delete(f.relativePath));
this.noneDeployScripts.forEach(f => filesSet.delete(f.relativePath));
}
// create a FileProjectEntry for each file
const fileEntries: FileProjectEntry[] = [];
filesSet.forEach(f => {