17

I'm getting errors during VSTS build process stating .net 4.6.2 is not found. Any idea when it will be made available on the build agents?

2016-08-30T17:09:31.0009946Z ##[error]C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1098,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.2" 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.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
mbreat
  • 361
  • 1
  • 3
  • 5

6 Answers6

22

Download the correct DEVELOPER targetting pack from here:

https://www.microsoft.com/net/targeting

Jon Barker
  • 1,788
  • 15
  • 25
  • 3
    Perfect! Just downloaded the 4.6.2 dev pack from the above link, installed it on my TFS Build 2017 server running on Windows Server 2016 and directly thereafter without reboots or restarts my builds succeeded. – Koen Zomers Mar 27 '17 at 16:43
  • 3
    There are two types "RunTime" and "Developer Pack". First tried with "RunTime" but that didn't help. But 'Developer Pack" helped. – David Feb 09 '18 at 18:31
5

First of all, be sure that the .NET framework are you using is listed here: Targeting .NET Platforms (I don't understand why 4.6.1 is not listed and 4.6.2 is listed.).

To resolve the issue about that the .Net Framework is not found, use Nuget 3.5.0 RC2. It solved the issue for me.

Nuget version that solve the issue

Andrés Villenas
  • 181
  • 1
  • 10
2

Based on my test, I can reproduce that issue with Hosted Build. Net Framework 4.6.2 isn’t available on Hosted Build now.

You can refer to this thread https://social.msdn.microsoft.com/Forums/en-US/f62a8156-d6a0-4a16-848e-ac426b3656a9/hosted-agent-support-for-net-framework-462?forum=TFService and vote this user voice https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/15691884-add-net-4-6-2-on-vsts-hosted-agent

The workaround is that you could setup a new build server on your machine with .Net Framework 4.6.2 be installed.

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • see comment by Paul Milbank from Microsoft on uservoice link above - 'Update your build server images please'. What does that mean if you are on hosted tfs2015 update3? – Edu M Jan 25 '17 at 11:30
1

just add this line to Build solution -> MSBuild Arguments

/p:TargetFrameworkVersion=v4.6.2

hirigoshy
  • 59
  • 3
1

Add below to web.config or mentioned by hirigoshy use targetframework property as part of build process.

<compilation debug="true" targetFramework="4.6.2"/>
henry
  • 11
  • 2
1

I experienced this issue when i was using a default Host as Agent- instead use a agent with dotNet Framework support. (e.g Hosted VS2017)

Malik Aqib
  • 513
  • 5
  • 21