我目前正在尝试使用 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 管道。此选项位于构建任务的高级
设置中。
对于 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/