首页 > 解决方案 > Azure Pipeline Build Using Microsoft.AspNetCore.App 2.2

问题描述

We are trying to get our .net core 2.2 app to build in Azure. But it is failing on the NuGet restore saying Version conflict detected on Microsoft.AspNetCore.Authentication, Reference the package directly from the project to resolve this issue.

We added to the web project and then it listed another and another. We can't keep adding all and looking at the build it is saying:

NU1607: Version conflict detected for Microsoft.AspNetCore.Cryptography.KeyDerivation. Reference the package directly from the project to resolve this issue.

MasterTemplate.Web (>= 1.0.0) -> MasterTemplate.Infrastructure.Identity (>= 1.0.0) -> Microsoft.AspNetCore.Identity.EntityFrameworkCore (>= 2.2.0) -> Microsoft.Extensions.Identity.Stores (>= 2.2.0) -> Microsoft.Extensions.Identity.Core (>= 2.2.0) -> Microsoft.AspNetCore.Cryptography.KeyDerivation (>= 2.2.0) MasterTemplate.Web (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0) -> Microsoft.AspNetCore.Cryptography.KeyDerivation (>= 2.1.0).)

I am not sure where Microsoft.AspNetCore.App (>= 2.1.0) is coming from as locally is says Microsoft.AspNetCore.App (2.2.0) in the NuGet list under dependencies. The NuGetCommand output in azure also says:

Restoring packages for .NETCoreApp,Version=v2.2...

Do I have to add something to our YML file to make this build correctly, I have tried adding specific versions like below without any luck.

 - task: DotNetCoreInstaller@0   displayName: 'Use .NET Core SDK Tool Installer'   
  inputs:
   version: 2.2.100
 - script: dotnet build --configuration $(buildConfiguration)   
   displayName: 'dotnet build $(buildConfiguration)'  
 - task: UseDotNet@2   displayName: 'Use .NET Core sdk'   
   inputs:     
     packageType: sdk
     version: 2.2.105
     installationPath: $(Agent.ToolsDirectory)/dotnet

Any help is greatly appreciated. YAML file below:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

标签: asp.net-core.net-coreazure-devopsnugetazure-pipelines

解决方案


推荐阅读