14

I tried to load a project I have and got this exception:

Severity Code Description Project File Line Suppression State Error 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.

And each time I'm trying to reload the project while loading it I'm getting this window:

Error

I'm not sure what to download and where from.

And I can't change any of the project properties I'm getting error in all the properties windows.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
user1196715
  • 583
  • 2
  • 6
  • 14
  • Which Visual Studio version did you install? Which .NET SDK versions are installed on the machine? VS 2015 came with 4.6.1 since Service Pack 1. Visual Studio 2017 includes 4.7. Are you usinge a very old Visual Studio version perhaps? – Panagiotis Kanavos Apr 02 '19 at 08:27
  • If you select the second option Visual Studio will download the correct SDK itself. If you use an old VS version like 2010 you should *really really* consider upgrading to a recent one - 2017 or 2019, which comes out today. – Panagiotis Kanavos Apr 02 '19 at 08:29
  • Possible duplicate of [msbuild 14 doesn't work without full .net framework installation](https://stackoverflow.com/questions/39567540/msbuild-14-doesnt-work-without-full-net-framework-installation) – Panagiotis Kanavos Apr 02 '19 at 08:30

3 Answers3

28

Either select "Download the targeting pack for..." from the dialog, or open the Visual Studio Installer, click "Modify" and select the 4.6.1 targeting pack from "Individual components":

enter image description here

Lennart
  • 9,657
  • 16
  • 68
  • 84
12

Windows -> Search -> Visual Studio Installer -> Modify -> Individual Components and check the right version

Cata Hotea
  • 1,811
  • 1
  • 9
  • 19
  • 1
    Or, OP could just select 'Download the targeting pack for ".NETFramework, Version=v4.6.1' and download the correct target version directly from the dialog – MindSwipe Apr 02 '19 at 08:23
  • @PanagiotisKanavos in his initial message he wrote : "Error The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found." So obviously he has to select this version :) even more obvious, he can just click download from that pop-up, but my solution is more general and a good to know one. – Cata Hotea Apr 02 '19 at 08:30
  • I tried to download from the dialog and got to this page: https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral But I have no clue what should I download there. – user1196715 Apr 02 '19 at 08:31
  • 1
    @user1196715 the thing you're looking for. The 4.6.1 SDK. If you simply search for `4.6.1` in that page you'll find it. What Visual Studio version are you using though? Recent versions should include this – Panagiotis Kanavos Apr 02 '19 at 08:32
  • @user1196715 just follow the steps in my initial answer – Cata Hotea Apr 02 '19 at 08:33
  • @PanagiotisKanavos My visual studio version is: Community 2017 version 15.9.6 and so fat it happened to me only on this project. Other projects mostly new never asked me this dialog. – user1196715 Apr 02 '19 at 08:35
  • @user1196715 yes there is. Yes, the version in in Visual Studio Installer. Lennart even posted a screenshot. – Panagiotis Kanavos Apr 02 '19 at 08:37
  • @user1196715 the search from your Windows bar. – Cata Hotea Apr 02 '19 at 08:38
  • Withdrawing all my comments. This is becoming a `How does Windows work` question – Panagiotis Kanavos Apr 02 '19 at 08:38
  • God. In the end the solution was to download the .NET Framework 4.6.1 Developer Pack on the page I provided before in my comments there is no SDK version 4.6.1 but there is a Framework version 4.6.1 and then you have to download the Developer Pack and not the Runtime. Just guessed after some tries. Why they can't make it easier to understand. – user1196715 Apr 02 '19 at 08:47
2

Or you can directly download the targeting pack from Microsoft's website here: https://www.microsoft.com/en-us/download/details.aspx?id=49978

You can find all kind of SDKs for both .Net Framework as well as .Net Core on the Microsoft site: https://dotnet.microsoft.com/download/visual-studio-sdks

Andor Baranyi
  • 197
  • 1
  • 8