5

I frequently work with the System.IO namespace. Is there a way to have that be included with each new project I create?

Thanks

JimDel
  • 4,309
  • 11
  • 54
  • 99
  • 1
    Seems like you would need to edit a VS template, see [this question](http://stackoverflow.com/q/651055/706456) – oleksii Mar 23 '12 at 15:20

3 Answers3

7

Adding it to the default template might be tricky, I would leave it alone.

You can easily create an empty project, make all sorts of settings and modifications and save it a s a new template (File|Export as template). A lot safer in the long run.

Just make it a habit of starting your new projects from your own custom templates.

If you really want to you can edit the contents of the file that is usually at c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\WindowsApplication.zip

H H
  • 263,252
  • 30
  • 330
  • 514
  • @mydogisbox - not hard but not something I'd do quickly. You may want to be able to create a 'default' project later. – H H Mar 23 '12 at 15:25
  • If he was changing something significant I would agree, but he wants to add the `System.IO` namespace. This is a trivial thing to remove. – N_A Mar 23 '12 at 15:26
  • 1
    Thanks, I dint think about creating my own template. I did look into editing the contents of the WindowsApplication file but I must have made some mistake because Windows Form disappeared completely from the available projects list. luckily I save a backup. My own template IS safer. – JimDel Mar 23 '12 at 16:39
1

Check out Changing the default using directives in Visual Studio.

Brian
  • 1,803
  • 1
  • 16
  • 22
1

The basic answer is to modify the class.zip file located here (for various options):

Visual Studio 2008

For 64 bit:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip

For 32 bit:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip Visual Studio 2010

For 64 bit:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip

For 32 bit:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip

And then run devenv.exe /installvstemplates in one of the following locations:

Visual Studio 2008 64-bit

cd C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\

32-bit

cd C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\

Visual Studio 2010 64-bit

cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\

32-bit

cd C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\

A more complete answer is here and here.

N_A
  • 19,799
  • 4
  • 52
  • 98