Reputation: 355
I've been trying to set up a proper devops pipeline using Azure DevOps. My problem is very similar to other posts but none fixed my problem of:
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).)
If I add this reference directly like suggested, then it just gives me a new one. I'd prefer to not have to add each one directly.
In this post: How do I resolve version conflicts in aspnet core 2.1? (2.1.1 >= 2.1.0-rc1-final)
The Answer suggests that I just need to set <PackageReference Include="Microsoft.AspNetCore.App" />
within my .csproj
file.
I've done this but still get the same error.
In this post:
It is suggested to use a dotnet-restore
, I believe I've put this into my azure-pipelines.yml
but honestly it might be the wrong command so I will post my pipelines
Azure DevOps build pipline constantly giving version conflict on every package
Here is my 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
...
I'll post my .csproj
in a gist:
https://gist.github.com/MilesWilde/e85f08f5bce40fa63222bbdcffc808cc
I also have a test botProj.test.csproj
but it seems like it doesn't influence the errors so I won't post it unless it makes sense to.
Any help with this is appreciated. Thank you.
Upvotes: 0
Views: 1195
Reputation: 355
This was fixed by specifying a version for the NugetToolInstaller@0
task in my pipeline and using the DotNetCoreInstaller@0
. This is my final .yml with some information removed
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
...
Upvotes: 1