由于错误条件,任务“NETSdkError”被跳过; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)')
Posted
技术标签:
【中文标题】由于错误条件,任务“NETSdkError”被跳过; (\'$(_TargetFrameworkVersionWithoutV)\' > \'$(NETCoreAppMaximumVersion)\') 被评估【英文标题】:Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)') was evaluated由于错误条件,任务“NETSdkError”被跳过; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)') 被评估 【发布时间】:2022-01-17 23:09:55 【问题描述】:当任务 DotNetCoreCLI@2
使用命令 restore
运行时,我的 Azure DevOps 管道中出现如下错误。
2021-12-14T15:55:06.3451639Z 1:5>Target "_CheckForUnsupportedNETCoreVersion" in file "/home/ziger/vsts-agents/adolin@pilos/_work/_tool/dotnet/sdk/6.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets" from project "/home/ziger/vsts-agents/adolin@pilos/_work/60/s/src/Data.csproj" (target "CollectPackageReferences" depends on it):
2021-12-14T15:55:06.3453249Z Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)') was evaluated as ('6.0' > '6.0').
2021-12-14T15:55:06.3453980Z 1:5>Done building target "_CheckForUnsupportedNETCoreVersion" in project "Intranet.Hub.Licensehandling.Data.csproj".
2021-12-14T15:55:06.3455558Z Target "_CheckForEolTargetFrameworks" skipped, due to false condition; ('@(_EolNetCoreTargetFrameworkVersions->AnyHaveMetadataValue('Identity', '$(_TargetFrameworkVersionWithoutV)'))' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(CheckEolTargetFramework)' == 'true') was evaluated as ('false' and '.NETCoreApp' == '.NETCoreApp' and 'true' == 'true').
这是我用于管道的模板(不完整,此处仅粘贴恢复任务)。
parameters:
- name: azureSubscription
type: string
- name: webAppName
type: string
- name: sourceBranchTrigger
type: string
stages:
- stage: build_stage
displayName: "Build"
jobs:
- job: build_job
steps:
- task: UseDotNet@2
displayName: "Install .NET Core SDK"
inputs:
version: 6.0.x
performMultiLevelLookup: true
includePreviewVersions: true # Required for preview versions
- task: DotNetCoreCLI@2
displayName: "Dotnet Restore"
inputs:
command: "restore"
feedsToUse: "select"
feedRestore: "Admin/Admin"
projects: "**/*.csproj"
includeNuGetOrg: true
你有没有遇到过这个问题?
【问题讨论】:
【参考方案1】:我可以通过在UseDotNet@2
任务中将版本替换为6.x
而不是6.0.x
来解决此问题。
- task: UseDotNet@2
displayName: "Install .NET Core SDK"
inputs:
version: 6.x
performMultiLevelLookup: true
includePreviewVersions: true # Required for preview versions
- task: DotNetCoreCLI@2
displayName: "Dotnet Restore"
inputs:
command: "restore"
feedsToUse: "select"
feedRestore: "Admin/Admin"
projects: "**/*.csproj"
includeNuGetOrg: true
【讨论】:
以上是关于由于错误条件,任务“NETSdkError”被跳过; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)')的主要内容,如果未能解决你的问题,请参考以下文章
如何解决 Sitecore 计划任务在添加后 10 分钟内被跳过的问题?
Antlr Eclipse IDE White Space 未被跳过