17
votes

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.

6

6 Answers

22
votes

Download the correct DEVELOPER targetting pack from here:

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

5
votes

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

2
votes

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.

1
votes

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

<compilation debug="true" targetFramework="4.6.2"/>
1
votes

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)

0
votes

just add this line to Build solution -> MSBuild Arguments

/p:TargetFrameworkVersion=v4.6.2