.net core NU1100:无法解析';System.Reflection.TypeExtensions(>;=4.5.1)和#x27;对于';。NETStandard,Version=v1.3';
我正在尝试我的小OSS项目,从AppVeyor到Azure DevOps,几乎完成了所有工作,但现在在.net core NU1100:无法解析';System.Reflection.TypeExtensions(>;=4.5.1)和#x27;对于';。NETStandard,Version=v1.3';,.net-core,azure-devops,nuget,.net-standard,asp.net-core-cli,.net Core,Azure Devops,Nuget,.net Standard,Asp.net Core Cli,我正在尝试我的小OSS项目,从AppVeyor到Azure DevOps,几乎完成了所有工作,但现在在dotnet还原步骤: NU1100:无法解析“.NETStandard,Version=v1.3”的“System.Reflection.TypeExtensions(>=4.5.1)” 尽管我清楚地看到它支持.NET标准1.3: .NETStandard 1.3 System.Reflection (>= 4.3.0) System.Resources.Resource
dotnet还原
步骤:
NU1100:无法解析“.NETStandard,Version=v1.3”的“System.Reflection.TypeExtensions(>=4.5.1)”
尽管我清楚地看到它支持.NET标准1.3:
.NETStandard 1.3
System.Reflection (>= 4.3.0)
System.Resources.ResourceManager (>= 4.3.0)
System.Runtime (>= 4.3.0)
我做错了什么
更新:如下所示:
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行,我假设这个错误与这个包无关,只是这个包是它试图恢复的第一个包,所以这就是它出错的地方,真正的问题更多的是这类事情的变体 诊断步骤1:将生成代理容器更改为不带visual studio的容器,并查看这是否修复了还原错误 我确信(1)恢复步骤对于dotnet核心工具链是多余的,(2)您必须使用dotnet核心工具链在您的dev桌面上构建 因此,我认为迁移到Azure的问题可能是:(1)如何构建正确的管道并不明显,(2)dotnet core/msbuild/nuget交互中可能存在一些bug
- 如果您使用GUI选项,那么您需要的唯一任务就是
任务dotnetcore
- 如果使用YML选项,那么首先只拾取从中提取的片段。该页面上的代码片段相当于在本地计算机上运行dotnet命令,因此可以在本地计算机上进行调试
- 我的结局是:
是否已包含来自的拉取请求?我can@ChrisFCarroll:这是源代码树/公共关系的源代码分支,我首先查看了该回购协议,但后来我意识到您的DevOps构建说它是由触发的,所以我想知道我是否在查看glennawatson的回购协议时出错了。但是现在我做了一个文件比较,我看到基于master的构建确实包含PR。在你的master repo中没有
azure pipelines.yml
文件,所以你正在用GUI构建管道?@ChrisFCarroll:它在.pipelines\build.yaml
,请看我更新了我的问题,发布了我的yaml管道文件。第二步是运行“dotnet restore”,它失败了,这让我很困惑。
trigger:
- master
pool:
vmImage: 'windows-2019'
variables:
solution: 'JWT.sln'
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
coreVersion: '2.2.106'
nugetVersion: '4.9.4'
steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core v$(coreVersion)
inputs:
version: $(coreVersion)
- task: DotNetCoreCLI@2
displayName: 'Restore NuGet packages for .NET Core'
inputs:
command: 'restore'
projects: '**/*.csproj'
- task: NuGetToolInstaller@0
displayName: Install NuGet v$(nugetVersion)
inputs:
versionSpec: $(nugetVersion)
checkLatest: true
- task: NuGetCommand@2
displayName: 'Restore NuGet packages for .NET Framework'
inputs:
command: 'restore'
restoreSolution: $(solution)
- task: DotNetCoreCLI@2
displayName: 'Build solution'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '-c $(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