title: Azure DevOps Pipeline error "Package (...) is not compatible with net60"
body: <p>I have source control and pipelines in Azure Devops.</p>
  <p>My project has two target frameworks: 3.1 and 6.</p>
  <p>While running the pipeline, it throws errors when restoring packages:</p>
  <blockquote>
  <p>##[error]The nuget command failed with exit code(1) and error(Errors in D:\a\1\s\nuget-tst\src\nuget-tst.csproj
  Package Microsoft.Extensions.Configuration.Json 3.1.3 is not compatible with net60 (.NETFramework,Version=v6.0). Package
  Microsoft.Extensions.Configuration.Json 3.1.3 supports:
  - netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  - netstandard2.0 (.NETStandard,Version=v2.0)
  Package Microsoft.Extensions.Configuration.FileExtensions 3.1.3 is not compatible with net60 (.NETFramework,Version=v6.0). Package
  Microsoft.Extensions.Configuration.FileExtensions 3.1.3 supports:
  - netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  - netstandard2.0 (.NETStandard,Version=v2.0)
  Package Microsoft.Extensions.Configuration.EnvironmentVariables 3.1.3 is not compatible with net60 (.NETFramework,Version=v6.0). Package Microsoft.Extensions.Configuration.EnvironmentVariables 3.1.3
  supports:
  - netcoreapp3.1 (.NETCoreApp,Version=v3.1)
  - netstandard2.0 (.NETStandard,Version=v2.0)
  One or more packages are incompatible with .NETFramework,Version=v6.0.
  Package Microsoft.IdentityModel.Tokens 6.5.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
  Microsoft.IdentityModel.Tokens 6.5.0 supports:
  - net45 (.NETFramework,Version=v4.5)
  - net461 (.NETFramework,Version=v4.6.1)
  - netstandard2.0 (.NETStandard,Version=v2.0)
  Package Microsoft.Extensions.FileSystemGlobbing 3.1.3 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package
  Microsoft.Extensions.FileSystemGlobbing 3.1.3 supports: netstandard2.0
  (.NETStandard,Version=v2.0)
  One or more packages are incompatible with .NETCoreApp,Version=v3.1.)
  ##[error]Packages failed to restore</p>
  </blockquote>
  <p>The azure pipelines yaml:</p>
  <pre><code>    trigger:
    branches:
        include:
        - master
  
  pr:
  - master
  - develop
  
  pool:
    vmImage: 'windows-latest'
  
  variables:
    solution: '*.sln'
    buildPlatform: 'Any CPU'
    buildConfiguration: 'Release'
    major: 1
    minor: 0
  
  name: $(major).$(minor)$(Rev:.r)
  
  stages:
  
  # Versioning master branch builds
  
  - stage:
    displayName: Build_Master_Version_Number
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
    jobs:
    - job: Build_Master_Version_Number
      variables:
         patch: $[counter(variables['minor'], 0)]
      steps:
        - bash: |
             echo &quot;##vso[build.updatebuildnumber]$(major).$(minor).$(patch)&quot;
          name: SetMasterBuildName
  
  # Versioning feature branch and PR builds
  
  - stage:
    displayName: Build_Branch_Version_Number
    condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
    jobs:
    - job: Build_Branch_Version_Number
      variables:
         prpatch: $[counter(variables['system.pullrequest.pullrequestid'], 0)]
         brpatch: $[counter(variables['build.sourcebranchname'], 0)]
      steps:
        - bash: |
             echo &quot;##vso[build.updatebuildnumber]$(major).$(minor)-PullRequest.$(prpatch)&quot;
          condition: eq(variables['Build.Reason'], 'PullRequest')
          name: SetPRBuildName
        - bash: |
             echo &quot;##vso[build.updatebuildnumber]$(major).$(minor)-$(Build.SourceBranchName).$(brpatch)&quot;
          condition: ne(variables['Build.Reason'], 'PullRequest')
          name: SetBranchBuildName
  
  # Stage for building your application
  
  - stage: Build_Steps
    displayName: Build_Steps
    condition: always()
    jobs:  
    - job: Build_Steps
      displayName: Build_Steps
  
      steps:
  
      - task: UseDotNet@2
        displayName: 'Use .NET Core SDK 3.1.200'
        inputs:
          packageType: sdk
          version: 3.1.200
  
      - task: UseDotNet@2
        displayName: 'Install .NET 6 SDK'
        inputs:
          packageType: 'sdk'
          version: '6.0.x'
          performMultiLevelLookup: true
  
      - task: NuGetCommand@2
        displayName: 'Restore packages'
        inputs:
          command: 'restore'
  
      - task: DotNetCoreCLI@2
        displayName: 'Build solution'
        inputs:
          command: 'build'
          arguments: '--configuration $(buildConfiguration) --no-restore /p:Version=$(Build.BuildNumber)'
          projects: '$(solution)'
      
      - task: DotNetCoreCLI@2  
        displayName: 'Pack packages'
        inputs:
          command: 'pack'
          versioningScheme: byBuildNumber
          arguments: '--configuration $(buildConfiguration)'
          packagesToPack: '**/*.csproj'
          nobuild: true
          packDestination: '$(Build.ArtifactStagingDirectory)'
      
      - task: NuGetCommand@2
        displayName: &quot;Publish to Nuget Feed&quot;
        inputs:
          command: 'push'
          feedsToUse: 'select'
          packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
          vstsFeed: 'nugetfeeds/Dev'
          publishVstsFeed: 'nugetfeeds/Dev'
      
  </code></pre>
  <p>The only way I found out to overcome was to set vmImage to 'windows-2019' but that seems odd to me. Why shouldn't it work with latest version (windows-latest)?</p>