Search code examples
.netmsbuildazure-devopsazure-devops-hosted-agent

Hosted VS2017 doesn't include .NET 4.6.0?


I had a CI job in AzureDevops passing (green) the build, targetting .NET 4.6.1. It uses an agent configured as "Hosted VS2017".

If I try to downgrade the build to .NET4.6.0 I get this compilation error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1179,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.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.

How to make sure the .NET 4.6.0 version is installed in the build agent? I don't find the option in AzureDevOps-Pipelines.


Solution

  • Azure DevOps should have all the SDKs and targeting packs installed AFAIK.

    Make sure you are targeting net46 and not net460 in your csproj.