Warm tip: This article is reproduced from serverfault.com, please click

Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v5.0" were not found

发布于 2020-11-30 19:24:47

I use azure pipeline when I update my project to .Net 5 I get this error at build solution step .

Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v5.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

so how can I solve this problem ?

Questioner
mohammadmahdi Talachi
Viewed
0
PatrickLu-MSFT 2020-12-01 16:29:54

It's supported.

Since you are using .Net 5, instead of using Nuget restore, try to use Use .net core taskand Dotnet core task with restore command.

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk 5.0.100'
  inputs:
    packageType: 'sdk'
    version: '5.0.100'
    includePreviewVersions: true

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: restore
    projects: '**/*.csproj'

It's strongly recommended to use dotnet restore and dotnet build tasks for projects that target .net core. See this statement from Nuget task:

Also take a look at this similar question here: Azure CI pipeline for Blazor .NET 5 doesn't work

For Classic editor, you could achieve this in same way, add use .NET Core and .NET Core task:

enter image description here