admin管理员组

文章数量:1123593

We are using a Database Project which contains all the database objects that make up our data warehouse. Our code is stored in Azure DevOps, and we have CI/CD processes in place in there as well. Part of that is an MSBuild task that attempts to build the project whenever a pull request is created, and this has been working fine in the past.

We switched to using Azure Data Studio (ADS) for maintaining our project. ADS prompted that it required some updates to the project file, so we added those lines to the project. Within Azure Data Studio, we can build the solution just fine, allowing us to verify we have a working solution without errors and/or warnings.

However, when we created a PR, we ended up getting an error:

Error MSB4057: The target "Build" does not exist in the project

Some searching and trying a few different things caused me to figure out that if I include the following line, DevOps will build the project just fine:

<Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />

Our problem is that when we then are unable to build the project in Azure Data Studio, where it throws the following error:

error MSB4278: The imported file "$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" does not exist and appears to be part of a Visual Studio component. This file may require MSBuild.exe in order to be imported successfully, and so may fail to build in the dotnet CLI. 

I'm currently side-stepping the issue by manually commenting this line in Data Studio, building locally, then uncommenting the line prior to committing my change when I'm ready for the PR. This is not a desirable long-term solution, though.

What I've tried so far:

  • Disabled the MSBuild task and added a Visual Studio Build task using the same parameters in the pipeline. This did nothing and the same error as above is thrown.
  • Attempted to add /p:NetCoreBuild=true to the MSBuild Arguments in the DevOps pipeline. This also did nothing.
  • Tried removing the initial new lines added by Azure Data Studio and building the project in Visual Studio. This also threw an error (though I will admit I spent most of my day dealing with resolving issues, so perhaps I ought to give this anotyher go now our overall solution is a bit more clean).

I'm basically hoping someone happened to go through this process before, and managed to find a solution. At this stage I went through about a dozen links to reach this situation, and I'm afraid I might have lost track of how to actually reproduce this situation in case I'd want to reproduce this in a clean new branch.

本文标签: