4
votes

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 ?

1
Is .NET 5 supported by Azure Pipelines?Vladimir Serykh
@VladimirSerykh it 's for yaml , what about for classic editor ?mohammadmahdi Talachi
Probably you want too much of the brand-new major version of the .NET 5. I think it will be updated. But it will take some time. If you want to be a .NET 5 pioneer, you should be ready to apply different workarounds.Vladimir Serykh

1 Answers

3
votes

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