5
votes

A TFS 2012 build server with .NET 4.6 installed produces the error message below when trying to build a website targetting .NET 4.6.

The machine has been restarted since the install.

Do I need to somehow tell TFS to favor .NET 4.6?

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (983): The reference assemblies for framework ".NETFramework,Version=v4.6" 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.

2

2 Answers

-4
votes

Firstly, you need to be sure that all referenced assemblies in the project can be found on the TFS build server. For best practice, you need to install VS2015 on the build server machine.

Secondly, you need to customize your TFS build process template to explicitly set the ToolPath variable in the Run MSBuild for Project activity to be C:\Program Files (x86)\MSBuild\14.0\Bin. Or add /tv:14.0 argument to MSBuild command.

11
votes

I installed the .NET Framework 4.6 Targeting Pack on the build server and that resolved it for me.