5

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 Answers 2

11

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

Sign up to request clarification or add additional context in comments.

5 Comments

Is it still the case that you do NOT need to install VS2015 on your build server if you install the Targeting Pack? I tried this approach but still received the error. The capabilities on my agent don't reflect that .NET 4.6 have been installed though. Is there another step required to update agent capabilities? Thanks!
In my case, I didn't have to install VS2015 to resolve the .NET 4.6 issue, only the 4.6 Targeting Pack. The box already has VS2013 installed on it.
@mcolegro your answer is misleading because you already had a prev version of Visual Studio installed on your build server. The contention is on whether or not we should even have a full VS install, or just the Target Pack on the build server.
@ThiagoSilva I merely stated the action I took to resolve the issue in my environment.
Thanks. Just installed all the files that were there not sure what the difference is. It solved the problem, even though the build server had .NET 4.6 installed.
-4

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.

5 Comments

Sad that we had to resort to installling Visual Studio on the build server.
Is it really true that Visual Studio is required to be installed?
Down voting for suggesting to install VS2015 on build server and saying it as 'Best Practice' this is misleading. You may have suggested (at the worst) to temp install and then remove. Installing a NET Framework multi targeting pack is recommended.
Can we get some confirmation that it's best practice to install VS on build machines?
Installing VS2015 on my power-house of a workstation takes the better part of an entire day. There's no way the best-practice is to install it on a build server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.