6

My Visual Studio 2013 solution has a project "Test". I can rename it in solution explorer, but I also want to rename the project folder in disk and also reflect the change in Source Control(TFS). How can I easily do this?

Thank you

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Sheen
  • 3,333
  • 5
  • 26
  • 46
  • Rename in TFS and sync that to your workspace, or use TFS Power Tools to rename from Explorer and sync that to the server. – CodeCaster Jan 18 '14 at 15:25
  • possible duplicate of [Renaming the containing project folder in VS.net under TFS](http://stackoverflow.com/questions/49066/renaming-the-containing-project-folder-in-vs-net-under-tfs) – Tim Abell May 23 '14 at 22:17
  • 2
    dupe of http://stackoverflow.com/q/49066/10245 - Best answer I've found for this: http://stackoverflow.com/a/10853509/10245 – Tim Abell May 23 '14 at 22:17

5 Answers5

3

@CodeCaster, Thank you. Based on your advice, I have done some quick experiment, and worked it out. First step is rename the folder name in TFS; the new folder will appear in local workspace and all contents of the folder moved to this new folder. The old folder stays there with rest content which not belong to source control. You can delete it manually.


Or Using TFS Power Tools to rename from Explorer. Renaming TFS folder using TFS power tools

Sheen
  • 3,333
  • 5
  • 26
  • 46
1

I followed those steps to preserve the version history of the files inside of TFS:

  1. Rename/move project file (.csproj) in source control explorer in VS (alternatively, this also works from within VS Solution explorer, simply select "rename")
  2. Rename/move project folder in source control explorer in VS
  3. now the project should be unavailable in VS, solution also gets closed
  4. remove project from VS
  5. add project (new path) to VS
  6. fix project references in other projects
  7. adjust namespaces if desired
  8. adjust assembly name and default namespace in project settings

Don't know of an easier way. Was searching for this myself, and this should be the way to go.

Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104
0

I think you can rename it from the TFS Database.

Try going into tbl_Project of the Tfs_DefaultCollection Database, which you can find on the SQL Server Instance used by tfs. You can know which one is that by going into the TFS Console, click on Application Tier, then find the details of the Server under the Data Tier Summary. Run an update query against the project you want to rename.. I haven't tested this but just assuming it should work (some educated guess)..

t_plusplus
  • 4,079
  • 5
  • 45
  • 60
0

I am using TFS 2015 Express and rename project is grayed out.

You can still rename the project using the TFS Site for the project.

Here is a link that shows how to do it.

https://www.visualstudio.com/en-us/docs/setup-admin/rename-team-project

Elim Garak
  • 1,728
  • 1
  • 16
  • 21
0

I was facing a similar issue while trying to rename a folder in Visual Studio 2015.This is what I tried.

  1. Right click on the project file
  2. Open with Notepad
  3. This will generate your current solution file
  4. Change the occurences of your prev file name. (Find and Replace with the desired name)
  5. Save it and close
  6. Change solution explorer name and rename the folder to your desired name.

This should work.

Pang
  • 9,564
  • 146
  • 81
  • 122
the_coder_in_me
  • 143
  • 3
  • 15