I have a project that builds using the following frameworks:
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
This compiles just fine on my local machine, but when I push it to Azure, it fails.
When I have the following in my YAML file:
variables:
solution: '**/*.sln'
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
platform: x64
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
Then I get:
##[error]C:\Program Files\dotnet\sdk\3.1.403\Microsoft.Common.CurrentVersion.targets(1177,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
And if I try
- task: VSBuild@1
displayName: 'Build all'
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
maximumCpuCount: true
I get:
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
- The developer packs documentation refer only to the older .Net Framework, so I suspect this is irrelevant/outdated.
- This works fine if I change .Net 5 for .Net Core 3.1, i.e.
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>