Click here to Skip to main content
13,290,176 members (57,838 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 28 Jan 2013

Visual Studio 2012 Set Default Target Framework to .NET4

, 28 Jan 2013
Rate this:
Please Sign up or sign in to vote.
First time you create a new project in Visual Studio 2012, the target framework is set to .NET 4.5.

The first time you create a new project in Visual Studio 2012, the target framework is set to .NET 4.5. A lot of the fellow developers end up creating the project in .NET4.5 by accident.


Figure 1 – Default target framework in the new project window is .NET Framework 4.5

In this blog post, I’ll show you how to tweak the registry to default the target framework to .NET 4 just to avoid accidentally creating projects in .NET 4.5.

WARNING: This solution is neither recommended nor supported by Microsoft. Editing the registry can lead to serious problems if not done correctly. Always backup your registry before editing.



Figure 2 – Path to the registry key ‘FxVersion’ to change the default framework to 4.0

Steps to Change the Default Target Framework to .NET 4.0 in Visual Studio

  1. Open registry by typing Regedit in the command or run prompt
  2. Navigate to the path HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\NewProjectDialog and look for the key ‘FxVersion’.
  3. You’ll notice ‘FxVersion’ is currently set to 4.5
  4. Double click FxVersion and change the value to 4.0
  5. Close the Registry and try to create a new project in Visual Studio 2012
  6. Voila! The default target version should now be .NET Framework 4


Figure 3 – Default target framework set to .NET 4.0 after setting FxVersion to 4.0

Note – If you changed the value of the framework in the new window to let’s say .NET 3.5, then the value of the FxVersion key will change to 3.5 as well. So, I have created a .bat file that gets called when Visual Studio is loaded which basically resets the value of the key FxVersion to 4.0 to ensure that it remains as the default target framework for all new projects.

Happy coding!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Avanade
United Kingdom United Kingdom
Solution Developer - C# .NET, ALM

Tarun Arora is a Microsoft Certified professional developer for Enterprise Applications. He has over 5 years of experience developing 'Energy Trading & Risk Management' solutions using Microsoft Technologies. Tarun has great passion for technology and travel (not necessarily in the same order)!

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171207.1 | Last Updated 28 Jan 2013
Article Copyright 2013 by Tarun_Arora
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid