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 ?
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.
This error occurs when you're building for . NET 5 or later, but you're using an older version of the . NET SDK. This issue can usually be resolved by upgrading to a newer version of your build tools.
It's supported.
Since you are using .Net 5, instead of using Nuget restore, try to use Use .net core task
and 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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With