Visual Studio Tip: Add Existing Directory

Friday, 02 January 2009
  • By
  • Jeff Ammons
  • Tags:
  • Tips
  • Tools
  • Visual Studio

How many times have you wanted to add a directory that already exists to your project only to have to create the directory (and any subdirectories) and then Add Existing Files (one directory at a time)?

Annoying isn't it? (Almost as annoying as someone who uses too many parentheses.)

Why, oh why, isn't there an Add Existing Directory function?

Because it isn’t needed.

What? You’re crazy!

If you copy the directory and all its subdirectories into the project (into the directory you want them) with File Explorer (or xcopy from the command line), then go into VS and click the little Show All Files icon at the top of the Solution Explorer pane (second icon from the right for me), voila! There are the directories that you want to add.

Now just highlight the grey little directory and right click. Next pick the menu item that says “Include In Project”.

Bam! You just kicked it up a notch! (Man that’s a tired catch-phrase, isn’t it?)

Does that ever save some time.

Today I needed to include Tiny MCE in my scripts folder in jeffaBlogger (MVC blog engine I'm working on). It finally was annoying enough to go Google up a solution.

Thanks to NitriqBlog for that little life-saver.