154

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.

3
  • 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, 2012 at 8:45
  • 1
    .NET 4.5 is an in place replacement. Refer to this blog post.
    – Vijay
    Oct 13, 2012 at 8:40
  • possible duplicate: stackoverflow.com/questions/9546353/…
    – Houman
    Oct 14, 2012 at 10:46

6 Answers 6

157

.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
7
  • 2
    Thanks, but what about this page from MSDN. msdn.microsoft.com/en-us/library/bb397428. It mentions a 4.5.0.0 directory? Aug 22, 2012 at 9:56
  • @NickRandell - You asked about the assemblies. That article as about the SDK/tools.
    – Oded
    Aug 22, 2012 at 9: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, 2012 at 9:58
  • I've definitely got 4.5 in those directories, but any idea about the tools? Aug 22, 2012 at 10:23
  • 7
    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, 2015 at 16:42
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.

4
  • Is this still true with the official release?
    – Earlz
    Sep 7, 2012 at 19:58
  • @Kiquenet: I suspect that was removed the final release; it's available as a separate nuget package.
    – Jon Skeet
    May 29, 2013 at 9:12
  • this is almost true - but msbuild has moved - see my post below
    – JonnyRaa
    Sep 25, 2014 at 13:18
  • @JonnyLeeds: Thanks - have added a reference to the blog post.
    – Jon Skeet
    Sep 25, 2014 at 13:20
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.

4
  • 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 3, 2012 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. Mar 3, 2012 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 2, 2017 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. Feb 2, 2017 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>
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".

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)

1
  • Note \v4\, not \v4.0\ which is different!
    – Tuntable
    Feb 2, 2017 at 19:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.