views:

39

answers:

1

I am in the process of upgrading from VS2008 to VS2010 and want to do some cleaning up. My main solution has 20 or so projects under it in a flat file space. However there is a grouping to the projects (some libraries, some client programs, some test programs etc) and I wanted to reorganise the physical disk layout of the projects in the appropriate manner. In addition my source control is VSS(1) so I want to keep its file structure aligned with the physical disk structure and keep the overall file history.

So what sort of tools are available to do this? Or am I better off cutting the solution to pieces and reassembling it in the desired locations?

There are a few SO questions that talk about the best layout for a solution, but none that I have seen that tell you how to get from A to B

How to refactor large projects in visual studio

Project layout on disk in visual studio

For example I want to go from "A"

Solution
  |
  |-Project1
  |-Project2
  |-Project3
  |-Project4

to "B"

Solution
  |
  |-Group1
  |   |
  |   |-Project1
  |   |-Project2
  |
  |-Group2
      |
      |-Project3
      |-Project4

update 1

I should have mentioned that I tried the obvious method of creating solution folders for "Group1" and "Group2" and then dragging the projects into their new locations under each folder. This works well for creating a logical organization of the projects within VS2010, but does not change the physical location of the projects on disk.

Update 2

I tried removing a project from the solution, physically moving it on disk and then adding it under a solution folder. This achieves the relocation on disk, but the project remembered where it was originally in VSS and linked up with those files, rather than VS2010 building a new project structure in VSS

Update 3

After thinking about it for a bit I have realized that what I am asking for is more how to realign VSS projects with the physical disk layout after I move the projects in VS2010. Fixing this will entail modifications to both the VSS project layout and the VS2010 project internals. So I have update the tags and question heading.

Update 4 - My manual solution

OK so I have worked out a very manually intensive method for moving things around:

  1. Remove the project from the VS2010 solution

  2. Move it to the new location on disk

  3. Delete all VSS related files from the project

  4. Open the project file in a text editor and strip out all VSS related entries (all those start with "Scc" )

  5. Add the project back into the solution and re-establish any project to project references

  6. Check the solution and the project back into VSS and close down VS2010

  7. Open up VSS and delete the code only files from the new project location in VSS

  8. Share in the files from the old location in VSS

  9. Delete the files from the old location in VSS

  10. Delete the old project location in VSS

Is this the best/only way of doing this?

Thanks

(1) Yes I know - VSS. However in the context that I am using it, it works perfectly fine and I have not had it put a foot wrong, and while I have explored other options I'm not about to change right now. So please, no comments about how I should move to the next best thing in source control. And if that doesn't get your hackles up, how about this: I actually use a currently available and actively supported commercial product that uses VSS as a backend, versioning data store!

A: 

It sounds like you're most of the way there. You can open up the .sln file in a text editor, and manually change the paths to the .(vs|cs)proj files. This should allow you to use the structure you want.

chris
Chris - I had thought about editing the sln file, but after a couple of attempts which screwed things up I gave up on that. Following the procedure I laid out above worked for me and it only took an afternoon to rearrange my solution. And then a bit more time to fix up all the relative paths used in my unmanaged c++ solutions! I'll give you the solution for at least taking the time out to give me an answer.
Peter M
Not sure how you'd screw up the .sln, unless your editor is adding additional characters. I do this almost every time I set up a new solution, manually changing the path to the project file so I have have the .sln file where I want it in relation to the projects. I use emacs, but belive that notepad++ will also work.
chris