.net - 管道上调用的目标已引发异常
问题描述
我为 .NET Framework 项目创建了构建管道。当管道由拉取请求触发时,我在任务中遇到此错误:'NuGet restore'
##[错误] nuget 命令失败,退出代码(1)和错误(解析解决方案文件时出错
d:\a\1\s\***.sln
:调用的目标已引发异常。无法加载项目文件。无法加载文件或程序集Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
或它的依赖项之一。系统找不到指定的文件。d:\a\1\s\***.sln
)##[error]包恢复失败
当我尝试在与目标分支合并后在本地计算机上编译解决方案时,我没有任何冲突或错误。
这是我的 YML 文件:
pool:
name: Hosted Windows 2019 with VS2019
demands:
- msbuild
- visualstudio
- vstest
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2 # --> This task fails.
displayName: 'NuGet restore'
inputs:
restoreSolution: '***.sln'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '***.sln'
platform: 'any cpu'
configuration: 'release'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact drop'
inputs:
PathtoPublish: ***
ArtifactName: 'drop wa'
它出什么问题了?
解决方案
nuget 任务目前似乎存在问题。您可能会尝试将版本更改为 5.4,因为这似乎可以解决包括我在内的某些人的问题。
推荐阅读
- python - 如何在 matplotlib 动画中使用函数作为“帧”参数?
- c++ - 我应该如何修改此代码以使用给定字符串中的字母打印菱形图案?
- java - 将 JUnit 导入 Intellij
- python - 将熊猫列中的字符串列表转换为字符串
- reactjs - 如何在 axios API 调用中使用“useParams()”?
- ruby-on-rails - 如何在 Ruby 中修改字符串,以便将所有撇号实例替换为反斜杠撇号
- authentication - 有哪些工具和方法可以为 Windows 自定义凭据提供程序编写自动化测试?
- javascript - 为什么 Firefox 显示“递归过多”错误?
- android - FirestoreRecycler 选项。当不需要索引时,查询需要索引错误。只有当我使用 orderBy
- html - 在不同的断点处使用相同的 SVG 时,SVG 线性渐变会损坏