在 Azure DevOps 上构建 sqlproj

标签 build azure-devops azure-pipelines sqlproj

我正在尝试使用 Azure DevOps Pipelines 从 GitHub 构建我的 .NET Core 2.1 解决方案。它包含一个 SQL 项目,其 TargetFrameworkVersion 为 v4.6.2 .这个项目总是无法构建。

Build FAILED.

/home/vsts/work/1/s/MySolution/MyDatabase/MyDatabase.sqlproj : warning NU1503: Skipping restore for project '/home/vsts/work/1/s/MySolution/MyDatabase/MyDatabase.sqlproj'. The project file may be invalid or missing targets required for restore. [/home/vsts/work/1/s/MySolution/MySolution.sln]
/home/vsts/work/1/s/MySolution/MyDatabase/MyDatabase.sqlproj(57,3): error MSB4019: The imported project "/usr/share/dotnet/sdk/2.1.403/Microsoft/VisualStudio/v15.0/SSDT/Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
1 Warning(s)
1 Error(s)

如何为构建服务器引用或包含这些目标?它在 VS2017 中构建良好。我花了一天多的时间打猎,找不到关于这个问题的任何信息。

最佳答案

感谢 Herman Cordes指导我的调查。

问题在于所选的构建服务器。 SSDT 是一个仅限 Windows 的包,所以我不得不使用 Windows VM 而不是默认的 Ubuntu VM,并使用 VSBuild@1 任务而不是 DotNetCoreCLI@2 .

azure-pipelines.yml

pool:
  vmImage: 'vs2017-win2016'

steps:
- task: VSBuild@1
  displayName: 'vsbuild $(buildConfiguration)'
  inputs:
    configuration: $(buildConfiguration)

编辑: MSBuild@1 任务也有效。

关于在 Azure DevOps 上构建 sqlproj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53473804/

相关文章:

Qt Creator 部署到远程 Linux 目标

android - 如何构建安卓框架

node.js - Node 构建 : read node_modules included on page and push them in an array bundle

sql - VSTS 构建不会拾取 dacpac 文件(云中的托管代理)

azure-devops - 一个存储库中的两个项目

azure - 使用Azure管道访问同一项目中的多个azure git存储库

.net - 无法在 Visual Studio Express VB.net 中构建

azure-devops - Docker 从 azure DevOps 引入管道?

ios - 是否可以运行 Azure 管道代理来在 Linux 上构建 iOS 应用程序?

azure - 有没有办法在 azure 管道构建中查看更多详细信息?