views:

337

answers:

3

How can I create a New project & Solution in the same, existing , directory? No matter what I do, it keeps creating a new (sub)directory for the project and populating that directory instead of the one(s) that already exist. I have the "Create directory for Solution" checkbox cleared so that it will put the solution an dproject in the same folder and not create a solution folder, but it still keeps making the project sub-folder.

How can I fix this?!?

This has bugged me for a long time, but I've been able to ignore it or work-around it up until now. But now it is kicking my butt productivity-wise on my customer project and I need to fix it. thanx... RBarryYoung

(Note: This is VS2005, Team Edition for Software Developers)

+1  A: 

From Visual Studio, if you have no solution open, you can select

File->New->Project From Existing Code

Select the project type

Put the directory you want the solution and project file to be in as the "Project file location" field.

Finish the wizard and you'll have a project file and solution file in the same directory.

If the "Project from existing code" option is not available you make a custom keyboard shortcut, toolbar button or menu item by using the customization features of VS.

Tools->Customize

Select the "Keyboard" button to add a keyboard shortcut or select the "Command" tab to add a toolbar button or menu item. The command you are looking for is:

File->New Project From Existing Code

Assign whatever keyboard shortcut or drag an icon to whichever menu/toolbar you want.

heavyd
I cannot find this option. I have File->New Project... which opens the New Project dialog, no "Project From Existing Code" option. ??
RBarryYoung
I am using Professional not Team, but after a bit of testing I see that the option is only available when I'm using the General, C# or C++ Development settings, when VS is configured to use VB or Web Development settings the option is not available. This can be changed by going to Tools->Import and Export Settings, and selecting Reset. It will give you the option to backup your current settings, then allow you to select a new profile.
heavyd
Another option if you don't want to change your development settings you can customize your environment with a keyboard shortcut or custom menu item or toolbar button:Tools->CustomizeThe command you're looking for is File.NewProjectFromExistingCodeI hope this works for you
heavyd
(huh, For some reason, I didn't get notified of your comments?) Could you edit your original answer to add in your additional information? Thanks, I will try these this afternoon
RBarryYoung
That worked, thanks!
RBarryYoung
A: 

You can always move things around manually and edit sln file to fix the project references. For example, if you want your solution file to be in the same directory as the project file, you can cut the solution file from wherever it is and paste it into the project file directory. Then you need to edit the solution file to fix the project reference so that the solution can find the project when it is opened.

Mehmet Aras
RBarryYoung
How often do you need to move projects around or add new ones that need to fit your organizational requirements? Not too often I hope. 3-4 hours per project means that there must be other things going. Merely moving the solution file, updating project references within it, and then opening the solution file in VS to check if projects load alright should not take that long.
Mehmet Aras
RBarryYoung
(re: I thought it would take an hour each).
RBarryYoung
A: 

I don't know of any out-of-the-box solutions for you. But, if the code files are organized into folders according to the wanted structure you could hack together a tool to do it for you, perhaps. The project files are not awfully complex in their structure, they are rather straight-forward XML documents, largely consisting of a list of the files that are included in the project.

I would assume that the resulting project files may still require some manual labour, but you should be able to get the code to do the heavy work for you. And you may get a nifty tool to post on your blog.

Fredrik Mörk