Right click, New Visual Studio Solution

I've often struggled with the way that Visual Studio's Blank Solution template creates projects.  Essentially you're given a folder for the solution, and projects go inside of it.  When you consider the fact that most projects have a host of other things related to it, not just source code, the structure found in most open source projects is more appealing.

For an example, this is what I'm talking about:

 

image

The project is well-organized and has places for build artifacts, 3rd party assemblies, documentation, etc.

For new projects, I find myself frequently performing these steps:

  • Open Visual Studio, File -> New Project, Blank Solution
  • Close Visual Studio
  • Navigate to the folder in Explorer
  • Create a new folder called src
  • Move the .sln file into the src folder
  • Double-click the new .sln file

Today I figured out how to just add a new right-click menu option in Windows Explorer.  It involved a simple registry hack, and a little hex editing.  The end result:

Choosing this new option adds a new file and opens it for rename:

image

Rename the file, and presto!

image

 

To add this to your system, copy & run this registry file (make sure remove the .txt):  right-click-sln.reg

Of course, you should be sure to back up your registry before running this file.  I'm not responsible for jacking up your system :).  Tested on XP SP3 & Vista x64 SP1.

#1 thedersen avatar
thedersen
3.11.2009
5:14 PM

This has been bothering me as well. Nice tip, thanks for sharing!


#2 Lee Brandt avatar
Lee Brandt
3.11.2009
6:41 PM

Handy! Thanks!


#3 Q avatar
Q
3.12.2009
12:25 PM

Please help me to understand what the problem is. I agree with you the steps you listed are not convenient (go to VS do somthing, then go to explorer do something, then go back to VS again), but my question is if you have to do that way. Can you instead just

1) go to explorer, create a folder (for your project)

2) still in explorer, create a sub-folder called src

3) open VS, and create an empty VS solution in that src folder

4) continue working in VS

Did I miss something?


#4 benscheirman avatar
benscheirman
3.12.2009
1:42 PM

@Q: It will still create a subfolder for the solution, so unless I name the solution src.sln, I still have the problem.


#5 Robz avatar
Robz
3.13.2009
7:04 AM

You create solutions that often? ;D

Handy tip, been using it since Nothin' But .NET with JP! He is big into this kind of stuff...


#6 Chris Sutton avatar
Chris Sutton
3.13.2009
1:43 PM

Thanks Ben, it worked on Win7 64bit with no problems.


#7 Marc Morgan avatar
Marc Morgan
4.06.2009
8:45 AM

Can you do this?

blogs.msdn.com/.../modify-default-