1
votes

I recently inherited a version controlled (TFS) .NET class library project that has the solution files and project files all in the same directory.

/projects
  /MyProject
    MyProject.csproj
    MyProject.csproj.vspscc
    MyProject.sln
    MyProject.suo
    MyProject.vssscc

I am fairly new to the .NET/VS/TFS world (I'm a Java/SVN guy) and my research shows that it is recommended to put projects in their own directory within a solution, allowing for the possibility of multiple projects:

/projects
  /MyProject
    /MyProject
      MyProject.csproj
    /MyFutureProject
      MyFutureProject.csproj
    MyProject.sln
    MyProject.suo

What is the recommended way to create directories and move files?

I tried simply creating a directory in Windows Explorer and moving the files, but when I opened the Solution in Visual Studio, it re-checked out the project from TFS in the root directory. I considered moving the files directly in the Source Control Explorer, but I don't know what kind of effects that may have. I also do not know the proper home for the .vspscc & .vssscc files. Any help to get me on the right track would be appreciated!

1
There exists no "good" way to do this. The best way (without manually editing your solution file) is to remove the projects you want to remove rom the solution. (right-click in Solution Explorer and Remove--which won't delete the files). Then move them in Windows Explorer and re-add them in VS...Peter Ritchie
@PeterRitchie is correct, no real good way to do this - however, be sure to remove any project references from the project first, then remove the project from the solution, then continue the process...d3r3kk
@PeterRitchie does my vspscc belong in the root directory or in the project directory?schmimd04
@schmimd04 the vspcc file is created by the SCC plugin, don't move it around or it will get recreated and you'll have multiplesPeter Ritchie

1 Answers

3
votes

I always start within TFS source control.

Create your new project folders under the solution folder. Move the project files into the new folder using TFS Move.

Open the solution, the project mappings will be wrong, then remap your projects either in the properties window, or by removing each individual project and then readding it.

You can then check in, everything will be where it should be and you will have retianed all the history.