3

I get the following error message when my pipeline is being run:

Package AutoMapper.Extensions.Microsoft.DependencyInjection 8.1.1 is not compatible with net60 (.NETFramework,Version=v6.0). Package AutoMapper.Extensions.Microsoft.DependencyInjection 8.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0) One or more packages are incompatible with .NETFramework,Version=v6.0.)

Is there something I can do here or do I need to wait for the AutoMapper team to update it?

4
  • 1
    It shoud work. Commented Nov 11, 2021 at 14:47
  • Getting the same error on a jenkins pipeline. Have you managed to find a solution to this? Commented Nov 23, 2021 at 15:20
  • 1
    It looks like the error in my case has nothing to do with Automapper. I had to create a completely new pipeline which fixed my issues. Commented Dec 13, 2021 at 17:40
  • I fixed the issue by using the dotnetcore-cli restore-task and switching to windows-2022. See my answer. Commented Jan 20, 2022 at 11:30

5 Answers 5

6

After some research, I decided to replace the NuGetCommand (NuGet-Task) with the DotNetCoreCli "restore" task. First I had to switch the "vmImage" from "windows-latest" to "windows-2022" as it seems the latest one has a grace period of a few months (read more here). Just before that, I had many more of those "is not compatible with net60" errors. Not just from AutoMapper.

Here is my Azure DevOps Pipeline YAML for all that had the same struggle to migrate their pipeline to .NET 6 as a starting point.

trigger:
  batch: true
  branches:
    include:
    - main

stages:
- stage: Build_Release
  pool:
    vmImage: windows-2022
  jobs:
  - job: Build
    variables:
      buildConfiguration: 'Release'
      solution: './SomeSolution.Name.sln'
    continueOnError: false
    steps:
 
    - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        feedsToUse: 'config'
        nugetConfigPath: '.\NuGet.config'
        externalFeedCredentials: 'Telerik NuGet Connection'

    - task: VSBuild@1
      displayName: 'Build Solution'
      inputs:
        solution: '$(solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:PublishProvider=FileSystem /p:ExcludeApp_Data=False /p:DeleteExistingFiles=True /p:PublishUrl=$(Build.ArtifactStagingDirectory) /p:Configuration=$(buildConfiguration)'
        configuration: '$(buildConfiguration)'
        maximumCpuCount: true
        createLogFile: true

    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifacts'
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'some-artifact-name'
        publishLocation: 'Container'

Edit: Removed the UseDotNet-Task as it seems not to be required when using windows-2022. Link

Sign up to request clarification or add additional context in comments.

1 Comment

UseDotNet is not required, but still recommended. It becomes essentially a no-op on the current windows 2022 image, but Microsoft can choose to stop precaching the version you depend on (like they recently did with a number of Node versions). In that case the task will ensure your pipeline keeps working.
1

It looks like the error in my case has nothing to do with Automapper. I had to create a completely new pipeline which fixed my issues.

2 Comments

I submitted an answer which fixed the same issue on my end.
Yep. See Nightking answer. Only came up Automapper because it was alphabetically my first package.
1

I have the same error and fixed them updated nuget version packet to 6.2.0 in pipeline

Comments

1

Had this when updating a solution to .Net 7.0. The solution was to update the Nuget version on the Build Pipeline:

For .Net 7.0 I had to make sure the Agent Specification was set to 'windows-2022'

enter image description here

Add a new task before the 'Nuget Restore' task > select 'Nuget tool installer': enter image description here

Then, change the display name and the version. For .Net 7.0, version 6.5.0 worked:

enter image description here

After that, the Build Pipeline run without issue

Comments

0

Issue is resolved by adding NuGet install task before any NuGet task, as follows:

  - task: NuGetToolInstaller@1
    displayName: 'Install NuGet >=6.3.0-0'
    inputs:
      versionSpec: '>=6.3.0-0'
      checkLatest: true

As detailed here https://github.com/dotnet/efcore/issues/27528

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.