Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Visual Studio 2012 Set Default Target Framework to DotNET4

, 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 us .NET 4.5.

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

image

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. 

 

image

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

Steps to change the default Target Framework to DotNet 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

image

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 project.

Happy Coding!

License

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

Share

About the Author

Tarun_Arora
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)!
Follow on   Twitter

Comments and Discussions

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