Ola*_*døy 4 azure-devops azure-pipelines
我正在尝试在 Azure Pipelines 中构建存储库。它在 Visual Studio 中构建正常,但是当使用 Azure Pipelines(在构建机器上运行代理)时,它失败并出现以下错误:
The nuget command failed with exit code(1) and error
Project MyProject is not compatible with netcoreapp2.2 (.NETCoreApp,Version=v2.2).
Project MyProject supports: netstandard2.0 (.NETStandard,Version=v2.0)
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
这是 yaml 构建脚本:
pool:
name: MyBuildServer
demands:
- msbuild
- visualstudio
steps:
- task: NuGetCommand@2
displayName: 'NuGet restore'
- task: VSBuild@1
displayName: 'Build solution **\*.sln'
- task: VSTest@2
displayName: 'Run tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
Run Code Online (Sandbox Code Playgroud)
NuGet 还原任务失败(与 netcoreapp2.2 不兼容),但它在 Visual Studio 中有效
Azure管道上使用的nuget版本似乎不是最新版本,可能会导致不兼容问题。
要解决此问题,您可以尝试添加一个 NuGet 工具安装程序任务,将其指向NuGet.exe
要安装的版本,您只需指定NuGet.exe
要在构建中执行的所需版本号即可。
正确配置后,使用最新版本的 .net 核心构建全部成功。
此外,如果以上不能解决您的问题,您可以尝试使用 dotnet restore 任务而不是 nuget restore 任务。
希望这可以帮助。
归档时间: |
|
查看次数: |
581 次 |
最近记录: |