Sunday 3 June 2012

How to Stop .Net 4 Client Profile being The Default in Visual Studio and Cocking Everything Up

The .Net 4 Client Profile project target in Visual Studio happens to be, about every couple of weeks or so, the bane of my fucking life. I will make a project, forgetting that it is the default for some of the templates and proceed to spend ten minutes wondering why the hell I can't find any references. This annoys the hell out of me and I have not found a way to back out of it being installed as a default for many types of project (listed on this msdn page)

At the behest of a work mate, I'm going to write this short guide on how to change the default for these projects.

In this example, I am going to change the default project target for the Console Application project type.

1. Find the right folder

I don't know where you have Visual Studio installed, but mine is at "C:\Program Files (x86)\Microsoft Visual Studio 10.0"

Further, you need to find where it keeps the project templates.

Should be in: {visual studio directory}\Common7\IDE\ProjectTemplates\CSharp\Windows\1033 (where 1033 is your language region)

2. Open up the archive ConsoleApplication.zip

Actually, best bet is just to extract it somewhere

3. Edit the file "consoleapplication.csproj"

Here we go. In the top PropertyGroup section. Here's the bastard to remove:

  $if$ ($targetframeworkversion$ >= 4.0)
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
  $endif$

Scrub that motherfucker like it ain't no thang.

4. Save, replace in archive, etc, etc

...

5. Wondering why this didn't work?

Because of reasons that I cannot fathom, there is a cache of the project templates.

6. Copy the files into the cache

They will need to go into a folder called "ConsoleApplication.zip", which will be found at: {visual studio directory}\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\1033

7. DONE

There... Hopefully that feels better. Thanks for wasting my time, Microsoft.

No comments:

Post a Comment