on-premises build agent is failing to build solution with projects on .net 4.7.1
Asked Answered
W

1

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,

Wreak answered 21/11, 2017 at 17:46 Comment(1)
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?Resistant
W
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

Wreak answered 22/11, 2017 at 17:35 Comment(2)
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.Jeane
@Jeane 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..Erlanger

© 2022 - 2024 — McMap. All rights reserved.