fix SDK style projects not being able to find system dacpacs (#18218)

* fix SDK style projects not being able to find system dacpacs

* fix tests
This commit is contained in:
Kim Santiago
2022-02-16 09:36:01 -08:00
committed by GitHub
parent 89cc59a2fd
commit d24a289af5
7 changed files with 13 additions and 8 deletions

View File

@@ -832,7 +832,8 @@ export class Project implements ISqlProject {
public getSystemDacpacUri(dacpac: string): Uri {
const versionFolder = this.getSystemDacpacFolderName();
return Uri.parse(path.join('$(NETCoreTargetsPath)', 'SystemDacpacs', versionFolder, dacpac));
const systemDacpacLocation = this.isSdkStyleProject ? '$(SystemDacpacsLocation)' : '$(NETCoreTargetsPath)';
return Uri.parse(path.join(systemDacpacLocation, 'SystemDacpacs', versionFolder, dacpac));
}
public getSystemDacpacSsdtUri(dacpac: string): Uri {

View File

@@ -29,7 +29,7 @@
<None Include="folder1\Script.PostDeployment2.sql" />
</ItemGroup>
<ItemGroup>
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\master.dacpac">
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>

View File

@@ -25,7 +25,7 @@
<Build Remove="file1.sql" />
</ItemGroup>
<ItemGroup>
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\master.dacpac">
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>

View File

@@ -38,7 +38,7 @@
<None Include="folder1\Script.PostDeployment2.sql" />
</ItemGroup>
<ItemGroup>
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\master.dacpac">
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>

View File

@@ -28,7 +28,7 @@
<None Include="..\other\folder2\Script.PostDeployment2.sql" />
</ItemGroup>
<ItemGroup>
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(NETCoreTargetsPath)\SystemDacpacs\150\master.dacpac">
<ArtifactReference Condition="'$(NetCoreBuild)' == 'true'" Include="$(SystemDacpacsLocation)\SystemDacpacs\150\master.dacpac">
<SuppressMissingDependenciesErrors>False</SuppressMissingDependenciesErrors>
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>

View File

@@ -30,10 +30,10 @@ describe('BuildHelper: Build Helper tests', function (): void {
const resultArg = buildHelper.constructBuildArguments('dummy\\project path\\more space in path', 'dummy\\dll path', true);
if (os.platform() === 'win32') {
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true');
should(resultArg).equal(' build "dummy\\\\project path\\\\more space in path" /p:NetCoreBuild=true /p:SystemDacpacsLocation=="dummy\\\\dll path"');
}
else {
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true');
should(resultArg).equal(' build "dummy/project path/more space in path" /p:NetCoreBuild=true /p:SystemDacpacsLocation="dummy/dll path"');
}
});

View File

@@ -83,8 +83,12 @@ export class BuildHelper {
public constructBuildArguments(projectPath: string, buildDirPath: string, isSdkStyleProject: boolean): string {
projectPath = utils.getQuotedPath(projectPath);
buildDirPath = utils.getQuotedPath(buildDirPath);
// Right now SystemDacpacsLocation and NETCoreTargetsPath get set to the same thing, but separating them out for if we move
// the system dacpacs somewhere else and also so that the variable name makes more sense if building from the commandline,
// since SDK style projects don't to specify the targets path, just where the system dacpacs are
if (isSdkStyleProject) {
return ` build ${projectPath} /p:NetCoreBuild=true`;
return ` build ${projectPath} /p:NetCoreBuild=true /p:SystemDacpacsLocation=${buildDirPath}`;
} else {
return ` build ${projectPath} /p:NetCoreBuild=true /p:NETCoreTargetsPath=${buildDirPath}`;
}