Archive

Posts Tagged ‘Templates’

How to Change Target Framework from Client Profile to .NET 4.0


Update Default Visual Studio Projects Target Framework

 

  • Go to %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
  • Browse into the folders you are interested in for example, \CSharp\Windows\1033\WPFApplication.zip\
  • Open the project file in Notepad, example WPFApplication.csproj
  • Find the following element <TargetFrameworkProfile>Client</TargetFrameworkProfile>
  • Delete the value of the TargetFrameworkProfile element (i.e. Client) => <TargetFrameworkProfile></TargetFrameworkProfile>
  • Save the file and close Notepad
  • Browse to %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\
  • Browse into the folder of interest (e.g C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033)
  • Extract the zip file for the project of interest (e.g WPFApplication.zip) NOTE: UAC may give you problems here, you may want to disable UAC or copy the zip file into your desktop
  • Replace the project file in the extracted folder with the one you edited in the ProjectTemplatesCache folder
  • Zip the file and copy it to the same location where it was
  • Open visual studio
  • Create new project based on the template you modified…Bingo 🙂

If you don’t want to modify the default templates, you need to create new project template

  • Create new project (e.g. WPF Application)
  • Go to project properties
  • Change target framework to .NET 4.0
  • Save the project
  • Click File –> Export Template, if you don’t see it make sure you open one of the files (e.g a .cs file)
  • In the Export Template Wizard
    • Choose project template
    • Choose the project you created
    • Click Next
    • Name the new template (e.g. WPF Application without Client Profile)
    • Take a note of the folder where the template is exported
    • Click finish
    • Copy the exported template to C:\Users\Owner\Documents\Visual Studio 2010\Templates\ProjectTemplates\ if you want the template to be available for you only. If you wanted to be available to all users on the computer, the *.zip file need to be copied to %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates
    • Open Visual Studio, the exported template may not be visible under the same project type (e.g. Visual C#—> Windows), it will be available under the language node (e.g. Visual C#)