21
votes

I have installed framework 4.7.2 on TFS 2013 server and trying to build a job using msbuild.

I am getting following error:

Task Parameter:TargetFrameworkMoniker=.NETFramework,Version=v4.7.2 (TaskId:6) C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1098,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.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. Output Property: _TargetFrameworkDirectories=

Any ideas on what I can check to make the FW 4.7.2 to work with MsBuild

2
Is the framework installed? Also, which build tools are you using? Are you able to use the latest build tools (i.e. VS 2017 build tools)?Mike Cheel
How about call msbuild from command line or build it from VS on the build server without TFS (If you have installed one in your build machine)? And try to adding a parameter: /p:TargetFrameworkVersion=v4.7.2 when you build with TFS.Leo Liu-MSFT
Any update for this issue? Have you resolved this issue? If not, would you please let me know the latest information about this issue?Leo Liu-MSFT
On another controller, I installed VS2017, I could not find the Msbuild in \15.0 directory. I only saw FileTracker folder in there. How can I get the MsBuild.exe in the 15 directoryNate
If you installed the VS2017, the MSBuild 15.0 should be located at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe, you can not find it there?Leo Liu-MSFT

2 Answers

25
votes

We just had a very similar issue, although we use Azure Devops rather than TFS (but I think the build process should be similar enough, at least regarding this).

I resolved it by updating .NET framework on the build server as well as installing the .NET Framework 4.7.2 developer pack, which you can get from here: https://www.microsoft.com/net/download/visual-studio-sdks

Don't forget to reboot (like I did). Once that's done, as Leo suggested try opening the project in Visual Studio directly on your build server or manually running msbuild from the command line.

1
votes

In some cases, the build definition may look fine at first glance. My Build > Tasks > Pipeline may have the correct Agent pool selected.

However, the Agent job, may have a completely different Agent pool selected.

In this case, just select the proper Agent pool and Save & queue a new build to resolve the issue.