51

I want to build a .net 4.5/VS2012 solution in TeamCity. My builds work on the agent that has VS2012 installed, but on the agent that doesn't have VS2012, I get warnings like this:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" 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.

Can I install the targets without installing all of Visual Studio 2012, like I could with .NET 4.0?

Where's the download?

(I feel ridiculous asking this...but I have searched and searched for it! Honest! This site suggests it's only available with VS2012, which seems like madness.)

Michael Haren
  • 105,752
  • 40
  • 168
  • 205
  • Have you installed .NET 4.5 itself on the build agent? That may be enough. – Jon Skeet Jun 20 '13 at 18:04
  • Yes, I have--the 48mb download. It doesn't seem to be enough. – Michael Haren Jun 20 '13 at 18:05
  • Hmmm. Maybe this particular issue is actually only giving me build _warnings_, not errors. Not as big of a deal, but I'm still curious if there's a way... – Michael Haren Jun 20 '13 at 18:07
  • I gave up and just installed [Visual Studio 2012 Express](http://www.microsoft.com/visualstudio/eng/downloads#d-2012-express) (for web). That fixed it. – Michael Haren Jun 20 '13 at 20:11
  • 1
    Same here. Builds fine with build agent on development machine. Fails with same problem on the build server agent. Copying the folder and rebooting didn't help - guess it doesn't register it with the GAC correctly. Installing VS2012 for web now ... Damn you MS and your assembly fragmentation! – Ales Potocnik Hahonina Oct 24 '14 at 16:29

8 Answers8

92

You don't need to install any SDK. Just copy the following folder from your development machine into the same folder of your TFS build machine:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5


If this doesn't work for you, refer to: http://getdotnet.azurewebsites.net/target-dotnet-platforms.html where you'll find the SDKs you need. However note the comment from @Lu55: Link to "Windows Software Development Kit (SDK) for Windows 8" from .NET Framework 4.5 section unexpectedly redirects to "Windows Software Development Kit (SDK) for Windows 8.1" which is for .NET Framework 4.5.1.


@dotarj mentions: The link for Windows Software Development Kit (SDK) for Windows 8, which is actually for .NET Framework 4.5, is: https://developer.microsoft.com/en-us/windows/downloads/windows-8-sdk

cederlof
  • 7,206
  • 4
  • 45
  • 62
  • 4
    This should be marked as the answer. Its easy, you likely have the files on your machine already, and it fixes the issue. – Chris Porter Oct 10 '14 at 20:54
  • 3
    Be on the alert while using the page mentioned above! Link to "Windows Software Development Kit (SDK) for Windows 8" from .NET Framework 4.5 section unexpectedly redirects to "Windows Software Development Kit (SDK) for Windows 8.1" which is for .NET Framework 4.5.1 – Ilya Serbis Nov 11 '15 at 14:12
  • Thanks @Lu55, I added your comment to the original post. – cederlof Nov 11 '15 at 14:52
  • 1
    @cederlof it looks like your sdk link is broken here is a new one http://getdotnet.azurewebsites.net/target-dotnet-platforms.html – richbria90 Jul 21 '16 at 23:16
  • 1
    Yep This worked for me in setting up my Jenkins server. Before I added the files to the said location, my build console output read "The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found." Once I added them, the message disappeared (then I removed rebuilt, then re-added and rebuilt to be sure). Now to fix the other 100 errors i am receiving... :p – Andy Aug 30 '16 at 09:59
  • 1
    Copying files from one machine to another is NEVER the best approach. Better to find the source and install it. – Gavin Stevens Sep 07 '16 at 16:45
  • 1
    As mentioned by @Lu55, you'll get redirected to the Windows Software Development Kit (SDK) for Windows 8.1. The link for Windows Software Development Kit (SDK) for Windows 8, which is actually for .NET Framework 4.5, is: https://developer.microsoft.com/en-us/windows/downloads/windows-8-sdk. – dotarj Mar 09 '17 at 12:26
27

If you're looking for proof it's in the Windows SDK here's the installer :

enter image description here

Note: This still doesn't give you Microsoft.WebApplication.targets for which you still need to either copy it manually, or install VS on your server.

I just went ahead with the free Visual Studio Express 2013 which fixed this.

Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
8

try to install the Windows SDK for Windows 8, http://msdn.microsoft.com/en-us/library/windows/desktop/hh852363.aspx, it worked for me.

Duftstenen
  • 81
  • 2
  • 1
    FYI - There is an option during the setup to be selective as to what you want to install. Specifically, there is an option for .NET Framework 4.5 / 4.5.1 SDK too. – Jaans Oct 21 '13 at 06:55
  • This solution worked for me, in my case it's not a build server, but a development machine with Visual Studio 2015. – Oscar Jul 22 '17 at 17:25
2

This is the official solution which worked for me (TFS 2012) http://dotnetnsqlcorner.blogspot.nl/2012/11/microsoftcommomtargets-warning-983.html

In short:

  1. Install SDK or Targetting-Pack for .NET Framework 4.5. But they are considerably large in size.
  2. The other option is to copy following folder from your development machine to your TFS build machine. C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5
Raffaeu
  • 6,694
  • 13
  • 68
  • 110
2

My OS is Win7 x64

I have the same problem and based on another answer I found a solution:

I have only "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" in my system and to resolve it I renamed v4.52 to v4.5 and it worked.

So for the long run I've made a junction to the 4.5.2 folder and renamed the junction point v.4.5 and it work.

ˈvɔlə
  • 9,204
  • 10
  • 63
  • 89
Khado Mikhal
  • 602
  • 7
  • 14
0

I was getting the error below on Windows Server 2016

The reference assemblies for framework ".NETFramework, Version=4.6.1" were not found

I went on my build server "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework" and noticed that I didn't have the required versions.

I then Installed the latest .NET Framework version from https://visualstudio.microsoft.com/downloads/

Anthony Liriano
  • 589
  • 1
  • 7
  • 16
0

I'm running into this problem in my project using Visual Studio 2013 and .NET 4.5. Seems like a problem because I moved the project to another directory.

You can fix this issue by verifying that the HintPath in the project file is correct or not (.csproj file).

<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1\System.Runtime.WindowsRuntime.dll</HintPath>

Since I created a new directory and moved my project into that directory, I found that the relative path to the System.Runtime.WindowsRuntime.dll in the HintPath was no longer correct, and thus, could not find the library.

Fixing this path resolved the issue for me.

Chef Pharaoh
  • 2,387
  • 3
  • 27
  • 38
-1

https://dotnet.microsoft.com/en-us/download/visual-studio-sdks has download links for each version of .NET Core and Framework

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465