【发布时间】:2021-09-07 09:07:23
【问题描述】:
我想根据 .editorconfig 验证我的应用程序的代码样式。对于此任务,我在 azure (2019) ci 管道中使用本地托管代理。我只被允许使用本地提要。所以我下载了 5.1.225507 版本的dotnet-format 并将其添加到提要中。
通过 yaml 管道中的以下步骤,我尝试验证代码样式:
# working build and test here...
- task: DotNetCoreCLI@2
displayName: 'dotnet install dotnet-format'
inputs:
command: custom
custom: tool
arguments: 'update -g dotnet-format --configfile ./.nuget/NuGetBuildServer.Config'
- task: DotNetCoreCLI@2
displayName: 'Validiere Codestil'
inputs:
command: custom
custom: format
arguments: '-v diag --configfile ./.nuget/NuGetBuildServer.Config --check --verbosity diagnostic --no-restore --verify-no-changes --severity info'
# working publishing here...
安装错误的运行时失败并出现错误。如何告诉 dotnet 使用 sdk 作为运行时?已安装:
[command]C:\dotnet\dotnet.exe --list-sdks
5.0.201 [C:\dotnet\sdk]
【问题讨论】:
-
该错误确切地告诉您问题是什么:您的代理没有安装所需的 .NET 运行时版本。
-
是的,但我为 .net 5.0.x 构建,这工作正常。为什么会出现这个错误? AFAIK .net 核心包含在 .net 5.0 中。我需要告诉他使用其他版本吗?
-
恭喜,您的代码在 .NET 5.0 上运行。 dotnet-format 没有,因此出现错误消息。 您应该阅读的内容。
-
解决了我的问题。我如何使用我安装的 sdk 作为运行时?还是 sdk 不包含 rutime?
标签: .net azure azure-devops dotnet-format