Issue using DotNetCoreCLI@2 to build a dacpac: Are Azure DevOps Build Pipelines Dependent on the project file

109 views Asked by At

We are setting up a build pipeline in our locally hosted Azure Devops environment to create a dacpac from a Visual Studio SQL project.

We are developing using Visual Studio 2022.

We are having issues using both the DotNetCoreCLI@2 and VSBuild@1 tasks.

For DotNetCoreCLI@2 we are getting the error

##
[error]NET\MySolution\MySolution.Database\MySolution.Database.sqlproj(56,3): 
Error MSB4019: 
The imported project "C:\Program Files\dotnet\sdk\8.0.100\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found.
Confirm that the expression in the Import declaration 
"C:\Program Files\dotnet\sdk\8.0.100\\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets"
is correct, and that the file exists on disk.

We have installed the SDK on the build server but as I understand it that is all that is needed. Visual Studio should not need to be on it.

Is that correct?

For VSBuild@1 we are getting the error

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(573,5): 
Error MSB4181: The "SqlBuildTask" task returned false but did not log an error.

We have other build pipelines happening on the same server but they do not have this issue.

Obviously we would like to get a fix for this so if anyone has any suggestions, we would be grateful.

Over and above that, The impression I get from errors I have experienced, is that whatever is in the project file has an influence on how a build pipeline executes.

The first issue above is a case in point. "C:\Program Files\dotnet\sdk\8.0.100\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" is not specified in the buld pipeline but in the project there is the following

 <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
    <!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
    <SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
    <VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
  </PropertyGroup>
  <Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
  <Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

Presumably this is what is driving the cause of the error.

However I cannot find any documentation discussing if project configuration influences build pipelines.

Does anyone have any insight on that?

Thanks

0

There are 0 answers