sentinel21
sentinel21

Reputation: 546

msbuild 15 failing with missing targeting framework

I installed build tools for visual studio 2017 (msbuild 15) and I'm having problems building a solution. I installed the framework (4.6.1) prior to installing the build tools, so it is present.

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

EDIT: Note that in this case, I'm actually trying to do a silent install of msbuild; so I don't have access to the UI.

Upvotes: 1

Views: 1204

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100741

You probably installed the framework, but not the targeting pack / "developer pack". You can check if the version exists as a subdirectory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework.

You can install the missing support by running the visual studio installer, click "Modify" on your VS 2017 installation and from "Individual Components" select the targeting packs and SDKs for the versions of .NET Framework you want to build for.

Upvotes: 4

Related Questions