The blog has moved to ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Wednesday, March 9, 2011

Visual Studio Solution Items in a sub directory

Visual Studio Solutions have the "Add New Solution Folder" option.

I don't know about you but this makes me think it is going to create a physical directory on the hard drive to emulate what is in the solution, but this is not the case.

The thing that really drives me crazy is if you try to add Test1.txt to the SubFolder it will throw an error because it is really trying to write to the root directory. I think solution folders are only really supposed to be used to organize Visual Studio projects.

In my case I want to have a set of files that are not really part of a Visual Studio project but I want them available in the solution. It turns out there is a Project type called "Empty Project".

This is exactly what the doctor ordered!

You will probably want to do one additional step. Set this "Empty Project" to not build, otherwise you will get a compile time error. Right click on the Solution > Properties > Configuration Properties > Configuration, then un-check the "Build" for this project.

Found out about this from this stackoverflow post.

Here is a good link explaining what you would use a solution folder for, besides a ReadMe.txt

No comments: