【发布时间】:2019-09-26 08:44:06
【问题描述】:
我正在尝试 to migrate 我的从 AppVeyor 到 Azure DevOps 的小型 OSS 项目,并且几乎完成了所有工作,但现在 getting this error 在 dotnet restore 步骤:
NU1100:无法解析“.NETStandard,Version=v1.3”的“System.Reflection.TypeExtensions (>= 4.5.1)”。
尽管我清楚地看到 System.Reflection.TypeExtensions 支持 .NET Standard 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
【问题讨论】:
-
github.com/jwt-dotnet/jwt 是否已经包含来自github.com/glennawatson/jwt/tree/alex/vsts-2 的拉取请求?我可以
-
@ChrisFCarroll:这是源代码树/公关的源代码分支github.com/glennawatson/jwt/tree/alex/vsts-2
-
我首先开始查看那个 repo,但后来我意识到你的 DevOps 构建说它是由 github.com/jwt-dotnet/jwt 触发的,所以我想知道我在查看 glennawatson 的 repo 时是否出错了。但是现在我做了一个文件比较,我看到基于 master 的构建确实包含 PR。
-
您的主存储库中没有
azure-pipelines.yml文件,所以您正在使用 GUI 构建管道? -
@ChrisFCarroll:在
.pipelines\build.yaml,见here
标签: .net-core azure-devops nuget .net-standard asp.net-core-cli