asp.net-mvc - 由于 "missing"包,Azure DevOps Pipeline 在构建步骤中失败。我该如何解决这个问题?

标签 asp.net-mvc azure azure-devops

我目前正在尝试使用 Azure DevOps Pipeline 为我的 ASP MVC Web 应用程序设置持续部署。每次 checkin 都会触发该管道。每次管道运行时,构建步骤都会失败。它显示的错误是:

    Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Nothing to do. None of the projects specified contain packages to restore.
D:\a\1\s\FantasyLeague\FantasyLeague.csproj(345,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.

Build FAILED.

D:\a\1\s\FantasyLeague\FantasyLeague.csproj(345,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\3.1.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\3.1.101\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.47

就在管道中的此步骤之前,有一个恢复步骤,该步骤应该恢复任何丢失的 NuGet 包,因此我不确定会发生什么,而且我是 Azure 的新手。任何帮助我克服这个障碍的帮助将不胜感激。谢谢!

最佳答案

您可以尝试启用构建任务的Restore NuGet Packages选项。

如果您使用的是经典 UI 管道。此选项位于构建任务的高级设置中。

enter image description here

对于 yaml 管道,您可以设置 restoreNugetPackages: true

- task: VSBuild@1
  inputs:
    solution: '**\*.sln' 
    restoreNugetPackages: true

希望以上有帮助!

关于asp.net-mvc - 由于 "missing"包,Azure DevOps Pipeline 在构建步骤中失败。我该如何解决这个问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60469933/

相关文章:

sql-server - 将 Guid 主键和聚集索引迁移到 INT (Azure SQL)

Azure 资源组不可用于已部署的资源

git - 触发 CI 特定分支并排除 Azure-Pipelines.YML 中的其他分支问题

azure-devops - Azure 管道服务容器 - 来自 AWS ECR 的图像

.net - 如何在 azure devops 上自定义燃尽图

c# - MVC3 Razor 和模态弹出窗口

jquery - Ajax 功能在本地运行时工作,但部署在 IIS 中时不工作

javascript - Jquery 无法使用 razor 来更新表内的数据

c# - 使用 Select Many 在 LINQ 方法语法中有条件地插入 Where 子句

azure - 部署 MEAN 应用程序