knocte
knocte

Reputation: 17949

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.

Upvotes: 0

Views: 735

Answers (2)

mfkl
mfkl

Reputation: 2159

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

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

Upvotes: 1

Nick Sinitsin
Nick Sinitsin

Reputation: 247

It installed on 100%. Because if you open image which MS use for agent VS2017 image you will see 4.7.2 installed. And if you take a look for example which version of framework supported here you will see

Microsoft .NET Framework 4.7.2 is a highly compatible, in-place update to .NET Framework 4, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, and 4.7.1.

That's why I think you can ask question in GitHub of image which MS use for agent.

I hope my answer will help you.

Upvotes: 1

Related Questions