Geeks With Blogs

News




View Tarun Arora's profile on LinkedIn

profile for Tarun Arora at Stack Overflow, Q&A for professional and enthusiast programmers

Tarun Arora - Visual Studio ALM MVP ALM, Agile, Automation, Performance Testing, Software QA, Cloud, ...

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 accidently 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!

 

Posted on Wednesday, January 23, 2013 11:20 PM TFS2010 | Back to top


Comments on this post: Visual Studio 2012 Set Default Target Framework to DotNET4

comments powered by Disqus

Copyright © Tarun Arora [Microsoft MVP] | Powered by: GeeksWithBlogs.net | Join free