12

I've made a lot of changes (a.k.a refactoring) to my (big) visual studio solution and it appears now that vs solution structure is very different in visual studio from what it is on the disk and TFS.

Is there a way to make file system (and TFS) have the same folder names and file names as in visual studio solution with some tool or script/program/helper add-in?

This is the list of main issues: - when I rename project visual studio does not rename folder where this project is located - if I move project, file to different vs folder, it just happens in visual studio, but not on the disk

2 Answers 2

9

You can switch between logical or physical folders in the solution by clicking the "Show all files" icon (2nd top left icon in the solution pane). When not activated, you are viewing logical folders in the solution, drag and drop simply re arrange files virtually. When activated, you are viewing physical folders, drag and drop moves files on disk, using the source controller.

2
  • 1
    using show all files also enable a right click on a excluded file and then a option apears include in project. This helped me a lot Dec 25, 2013 at 19:02
  • 2
    For VS2012 and later the "show all files" button may not appear. Here are some tricks to make it visible stackoverflow.com/questions/14383234/… Jun 26, 2014 at 15:55
3

No there are no tools that can help you do this automatically.

There is a two step approach to solve it, made easier by installing two add-ons. I prefer to use the Team Foundation Power Tools and the Source Control Explorer Extensions.

From the Source Control Window inside Visual Studio:

  1. Close the open solution in Visual Studio
  2. open the Source Control window in TFS
  3. Move the folders around to match the structure you prefer, with the mentioned add-ons you should be able to drag/drop and rename them more easily

Alternatively, do the changes on file system with the Team Foundation Power Tools explorer extensions installed:

  1. Close the solution in Visual Studio
  2. navigate to your workspace folder using Windows Explorer
  3. use the TFS context menu on the folders to check-out/rename/move the items ans folders

Then re-load the solution in Visual Studio and:

  1. Open the solution and see that a lot of projects don't load.
  2. Highlight a project that couldn't be found
  3. On the project properties window (ctrl-w, p) find the file path item and click the little [...] button to navigate to the new project file location for each project.
  4. Rightclick the projects you've updated this way in the solution explorer and reload them

Rebuild your solution to verify all changes went as expected

  1. Check-in your changes
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.