9

We have recently upgraded some projects to .net framework 4.7.1 but our on premise build agent is failed to run the build solution build step. We are using Visual Studio Team Services.

The full error is...

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets (1122, 5) C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1122,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7" 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.

The build machine is a windows server 2016 azure VM with Visual Studio 2017, 15.4.4 installed. I manually installed the 4.7.1 .net framework sdk from here: https://learn.microsoft.com/en-us/dotnet/framework/whats-new/index#v471.

I've rebooted and restarted the agent service but still it failed with the above.

Any ideas how to resolve this issue?

The full build solution log file can be found here: Build solution log gist

Thanks,

Konzy262
  • 2,747
  • 6
  • 42
  • 71
  • In the build agent (Azure VM), what if you open/create a .net framework app, and then open the project porperity, can you find .net framework 4.7.1 from **Target framework** drop down list? – Marina Liu Nov 22 '17 at 08:34

1 Answers1

27

It turned out the issue was due to not having the 4.7 SDK and 4.7 targeting pack checked under individual components in Visual Studio.

enter image description here

Konzy262
  • 2,747
  • 6
  • 42
  • 71
  • 4
    This is the correct answer. Even though I downloaded and installed it via the installer, it still need to be installed yet again through this installer, with the targeting pack. – Shane Sep 26 '18 at 16:53
  • @Shane thanks - I had to do the same thing - install through Visual Studio Installer!! I guess the programmer never checked for the offline out of VSI install.. – Ken Jul 30 '20 at 21:48