153

I've installed Windows 8, Visual Studio 2012 but don't have a v4.5 directory in %WINDIR%\Microsoft.NET\Framework.

Have I done something wrong, or is .NET 4.5 different from others?

If it's because I have not installed the tools, is there a set of different tools to download? As far as I can tell, I am able to build .NET 4.5 apps OK.

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
Nick Randell
  • 17,805
  • 18
  • 59
  • 74
  • 1
    @Gustavo, *please* stop editing that tag into questions. The product name is **not** 2011, but 11, and there is already an existing tag. – Charles Apr 14 '12 at 08:45
  • 1
    .NET 4.5 is an in place replacement. Refer to [this blog post](http://blogs.msdn.com/b/vijaysk/archive/2012/10/12/where-is-asp-net-4-5-wait-where-is-net-4-5.aspx). – Vijay Oct 13 '12 at 08:40
  • possible duplicate: http://stackoverflow.com/questions/9546353/where-are-net-4-5-assemblies-located – Houman Oct 14 '12 at 10:46

6 Answers6

156

.NET 4.5 is an in place replacement for 4.0 - you will find the assemblies in the 4.0 directory.

See the blogs by Rick Strahl and Scott Hanselman on this topic.

You can also find the specific versions in:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • 2
    Thanks, but what about this page from MSDN. http://msdn.microsoft.com/en-us/library/bb397428. It mentions a 4.5.0.0 directory? – Nick Randell Aug 22 '12 at 09:56
  • @NickRandell - You asked about the assemblies. That article as about the SDK/tools. – Oded Aug 22 '12 at 09:57
  • @NickRandell - And since that's not on your system, look at the version of the assemblies in the 4.0 directory to see if they are indeed the 4.5 (as described in the linked blogs). – Oded Aug 22 '12 at 09:58
  • I've definitely got 4.5 in those directories, but any idea about the tools? – Nick Randell Aug 22 '12 at 10:23
  • this is almost true - but msbuild has moved - see my post below – JonnyRaa Sep 25 '14 at 13:17
  • 6
    FYI: I just installed v4.5.2 on my Windows Server 2008 R2. The assemblies are actually in C:\Windows\Microsoft.NET\Framework\v4.0.30319, as pointed by Jon Skeet. – harsimranb Mar 17 '15 at 16:42
  • I believe you actually have to install *.NET Framework 4.6* to see the 4.5 assemblies at this path. A co-worker had 4.5, but did not have the .NETFramework folder, only v3.0 and v3.5. Once we had him install 4.6, the .NETFramework folder (among others) and subfolders could then be found. – vapcguy Jul 07 '16 at 18:06
95

EDIT: This answer was correct until mid-2013, but you may have a more recent version since the big msbuild change. See the answer from Jonny Leeds for more details.

The version under C:\Windows\Microsoft.NET\Framework\v4.0.30319 actually is .NET 4.5. It's a little odd, but certainly mscorlib there contains AsyncTaskMethodBuilder etc which are used for async.

.NET 4.5 effectively overwrites .NET 4.

Stephen
  • 1,737
  • 2
  • 26
  • 37
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
28

.NET 4.5 is not a side-by-side version, it replaces the assemblies for 4.0. Much like .NET 3.0, 3.5 and 3.5SP1 replaced the assemblies for 2.0. And added some new ones. The CLR version is still 4.0.30319. You only care about the reference assemblies, they are in c:\program files\reference assemblies.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • I'd thought 3.0 and 3.5 just added assemblies - not replacing (say) mscorlib as 4.5 does. Or was that maybe true for 3.0 but not 3.5? – Jon Skeet Mar 03 '12 at 13:32
  • @Jon - no, they actually got replaced. That caused some misery because the [AssemblyVersion] didn't change. The added WaitHandle.WaitOne(int) overload was especially notorious. There were counter-measures in .NET 4 to avoid this problem, the reference assemblies are no longer a copy of the GAC-ed assembly. They are special, they contain no IL. – Hans Passant Mar 03 '12 at 13:44
  • For testing across multiple versions, is there any easy alternatives to virtual machines? And does Windows Update automagically update to 4.5 by default? – Tuntable Feb 02 '17 at 19:42
  • 2
    That looks like a question, not a comment. Questions go at the top of the page, click the Ask Question button to put it there. – Hans Passant Feb 02 '17 at 21:46
17

Whilst the above answers are correct its worth noting that MSBuild has changed and it no longer ships with the .net framework, it comes either stand alone or with visual studio. As a result it's binaries have moved... so the one you get under the 4.0.303619 directory is actually the old one!

I've just been caught out by this - I found automatic binding redirects were only working when running from VisualStudio but not when running msbuild from the command line... the clue was that binding redirects were added in VS 2013 (for that read .net framework 4.5). If you open up a vs command prompt you'll see it now gets it from program files as the other article mentions. Whereas I was using a batch file on my path which linked to the old version.

Version numbers

Under framework:

PS C:\Windows\Microsoft.NET\Framework\v4.0.30319> .\msbuild.exe -version
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34014]
Copyright (C) Microsoft Corporation. All rights reserved.

4.0.30319.33440PS C:\Windows\Microsoft.NET\Framework\v4.0.30319>

Under program files:

PS C:\Program Files (x86)\MSBuild\12.0\Bin> .\MSBuild.exe -version
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.34014]
Copyright (C) Microsoft Corporation. All rights reserved.

12.0.21005.1PS C:\Program Files (x86)\MSBuild\12.0\Bin>
JonnyRaa
  • 7,559
  • 6
  • 45
  • 49
6

The webpage is incorrect and I have pointed this out to MS and they will get it changed.

As already stated above .NET 4.5 is an in-place upgrade of 4.0 so you will only have Microsoft.NET\Framework\v4.0.30319.

The ToolVersion for MSBuild remains at "4.0".

Adam
  • 61
  • 3
3

The official way to find out if you have 4.5 installed (and not 4.0) is in the registry keys :

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full

Relesae DWORD needs to be bigger than 378675 Here is the Microsoft doc for it

all the other answers of checking the minor version after 4.0.30319.xxxxx seem correct though (msbuild.exe -version , or properties of clr.dll), i just needed something documented (not a blog)

code7amza
  • 181
  • 1
  • 8