When we work on big projects, there is a need to set up a development tree (directory structure) and not just put everything in the bin\Debug or bin\Release folder. There are some “how to set up a good development tree” best practices and even a .NET development tree generator called Tree Surgeon. Some of the folders in this directory structure shall be “Resources” (set of icons and images) and “Config” (set of configuration files).

How many times did you search for a specific configuration file or a specific icon in the development tree (assuming it is a big one)? You come back to a component you wrote several years ago and can’t recall where did you locate your files. Wouldn’t it be nice if for each project, our resources and configuration files could be seen form visual studio? We would never need to find them using the windows explorer anymore and we will always have them right there even when coming back to a code which was written 2-3 years ago.

So, my advice is to add 2 additional folders to your Visual Studio project called “Resources” and “Config files”. Then, Add the appropriate files to those folders. I am not talking about embedding your resources into the assembly (cause a significant increase to the size of your executable, but you sometimes need it) but about adding those files as references. To achieve that goal, do the following: after choosing to add an existing item, click on the arrow on the “Add” button and choose “Add As Link”:

image

Your project will eventually look like this:

image

Notice that those are only references to the files, but you can easily tell which configuration files are used by your project. This post didn’t teach you new tricks, except for the “Add As Link” option maybe. But from my experience, most of my co-workers (including me) didn’t use that advice before. what do you think about it? Do you find it helpful?

Tags :

3 Responses to “Add Configuration Files To Your Visual Studio Project”


  1. Ramy

    Said on March 5, 2009 :

    It’s really useful and as you mentioned I was embedding the whole resources in the assembly …. big bang file size

    thank you

  2. Francisko

    Said on June 12, 2009 :

    I try to do it in my box and it’s not working .
    Is there any special settings I need to setup?

1 Trackback(s)

  1. Aug 19, 2008: Dew Drop - August 19, 2008 | Alvin Ashcraft's Morning Dew

Post a Comment