我一直在尝试使用Azure DevOps设置一个合适的devops管道。我的问题与其他帖子非常相似,但都没有解决我的问题:NU1607: Version conflict detected for Microsoft.AspNetCore.Antiforgery. Reference the package directly from the project to resolve this issue. botProj (>= 1.0.0) -> Bot.Builder.Community.Middleware.Typing (>= 1.0.82) -> Microsoft.AspNetCore.Mvc.ViewFeatures (>= 2.1.1) -> Microsoft.AspNetCore.Antiforgery (>= 2.1.1) botProj (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.AspNetCore.Antiforgery (>= 2.1.0).)
如果我像建议的那样直接添加这个引用,那么它只会给我一个新的引用。我不希望直接添加每一个。
在本文中:How do I resolve version conflicts in aspnet core 2.1? (2.1.1 >= 2.1.0-rc1-final)
答案是,我只需要在.csproj文件中设置<PackageReference Include="Microsoft.AspNetCore.App" />。我已经这样做了,但仍然得到相同的错误。
在这篇文章中:建议使用dotnet-restore,我相信我已经把它放到了我的azure-pipelines.yml中,但老实说,这可能是错误的命令,所以我将发布我的管道Azure DevOps build pipline constantly giving version conflict on every package
这是我的azure-pipelines.yml
vmImage: 'windows-2019'
trigger:
- dev/mybranch
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '2.2.101'
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: 'ibibot_ops/NuGet.Config'
- task: VSBuild@1
...
- task: VSTest@2
...我会把我的.csproj写成一个要点:https://gist.github.com/MilesWilde/e85f08f5bce40fa63222bbdcffc808cc
我也有一个测试botProj.test.csproj,但它似乎不会影响错误,所以我不会张贴它,除非它有意义。
在这方面的任何帮助都是非常感谢的。谢谢。
发布于 2019-08-15 23:16:44
通过在我的流水线中为NugetToolInstaller@0任务指定一个版本并使用DotNetCoreInstaller@0修复了这个问题。这是我删除了一些信息后的最终.yml
steps:
- task: DotNetCoreInstaller@0
displayName: 'Use .NET Core sdk 2.2.101'
inputs:
version: 2.2.101
continueOnError: true
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.9.1'
inputs:
versionSpec: 4.9.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
feedsToUse: 'config'
nugetConfigPath: './NuGet.Config'
- task: VSBuild@1
...
- task: DotNetCoreCLI@2
...
- task: PublishCodeCoverageResults@1
...https://stackoverflow.com/questions/57500748
复制相似问题