gpt4 book ai didi

.net-core - NU1100 : Unable to resolve 'System.Reflection.TypeExtensions (>= 4.5.1)' for '.NETStandard,Version=v1.3'

转载 作者:行者123 更新时间:2023-12-05 07:23:26 26 4
gpt4 key购买 nike

我正在尝试 to migrate我从 AppVeyor 到 Azure DevOps 的小型 OSS 项目几乎完成了所有工作,但现在 getting this errordotnet restore 步骤上:

NU1100: Unable to resolve 'System.Reflection.TypeExtensions (>= 4.5.1)' for '.NETStandard,Version=v1.3'.

尽管我清楚地看到System.Reflection.TypeExtensions支持 .NET 标准 1.3:

.NETStandard 1.3
System.Reflection (>= 4.3.0)
System.Resources.ResourceManager (>= 4.3.0)
System.Runtime (>= 4.3.0)

我做错了什么?

更新: my YAML file看起来像这样:

trigger:
- master

pool:
vmImage: 'windows-2019'

variables:
solution: 'JWT.sln'
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
dotNetVersion: '2.2.106'

steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core v$(dotNetVersion)
inputs:
version: $(dotNetVersion)

- task: DotNetCoreCLI@2
displayName: 'Restore NuGet packages'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: config
nugetConfigPath: NuGet.config

- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: '$(solution)'
configuration: '$(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: Run .NET Core tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.Core.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Run .NET Framework tests
inputs:
command: 'test'
projects: 'tests/**/JWT.Tests.NetFramework.csproj'
arguments: ' -c $(buildConfiguration) --no-build --no-restore'
testRunner: VSTest
testResultsFiles: '**/*.trx'
testResultsFormat: 'xUnit'
failTaskOnFailedTests: true

- task: DotNetCoreCLI@2
displayName: Package NuGet package
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
configuration: $(BuildConfiguration)
nobuild: true

- task: PublishBuildArtifacts@1
displayName: Publish build artifacts

更新 2:我尝试分别恢复 .NET Core 和 .NET Framework 的包,但没有成功:

  displayName: 'Restore NuGet packages for .NET Core'
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: config
nugetConfigPath: NuGet.config

- task: NuGetCommand@2
displayName: 'Restore NuGet packages for .NET Framework'
inputs:
command: 'restore'
restoreSolution: $(solution)
feedsToUse: config
nugetConfigPath: NuGet.config

- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: '$(solution)'
configuration: '$(buildConfiguration)'

但有效的是显式恢复包的原始 MSBuild:

- task: MSBuild@1
displayName: Build solution
inputs:
solution: $(solution)
msbuildArguments: /restore /t:build /p:CreatePackage=true /p:NoPackageAnalysis=true /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
configuration: $(BuildConfiguration)
maximumCpuCount: true

最佳答案

我认为您的 dotnet 恢复任务不是 dotnet 恢复,而是某种 msbuild/NuGet 恢复?

特别是,从日志的最后 20 行来看,我假设这个错误与这个包无关,只是这个包是它尝试恢复的第一个包,所以这是它出错的地方,真正的问题更多是关于 https://github.com/NuGet/Home/issues/4821 的变体类似的东西。

诊断步骤 1:将构建代理容器更改为没有 visual studio 的容器,看看是否修复了还原错误。

我确信 (1) 恢复步骤对于 dotnet 核心工具链是多余的,并且 (2) 您必须使用 dotnet 核心工具链在您的开发桌面上构建?

所以我认为迁移到 Azure 的问题可能是,(1) 如何构建正确的管道并不明显,以及 (2) dotnet core/msbuild/nuget 交互中可能存在一些错误。

关于.net-core - NU1100 : Unable to resolve 'System.Reflection.TypeExtensions (>= 4.5.1)' for '.NETStandard,Version=v1.3' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56043733/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com