Sheen
Sheen

Reputation: 3441

Rename project folder in Visual studio and Team foundation server

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

Upvotes: 6

Views: 18433

Answers (5)

Sheen
Sheen

Reputation: 3441

@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

Upvotes: 3

Andreas Reiff
Andreas Reiff

Reputation: 8404

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.

Upvotes: 1

the_coder_in_me
the_coder_in_me

Reputation: 143

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.

Upvotes: 0

Elim Garak
Elim Garak

Reputation: 1827

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

Upvotes: 0

t_plusplus
t_plusplus

Reputation: 4209

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)..

Upvotes: 0

Related Questions