Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
484 views
in Technique[技术] by (71.8m points)

visual studio 2008 - Renaming the containing project folder in VS.net under TFS

I have a vs.net project, and after some refactoring, have modified the name of the project. How can I easily rename the underlying windows folder name to match this new project name under a TFS controlled project and solution?
Note, I used to be able to do by fiddling with things in the background using SourceSafe ...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Check in all pending changes within the folder and ensure that all other team members to do the same.
  2. Ensure that you have a copy of the folder in your working directory (otherwise, you will not have the option to rename the folder in the Source Control Explorer in the next step). Get latest version on the folder to get a copy if you don't already have one.
  3. Close the solution.
  4. Rename the folder within the Source Control Explorer. This will move all of the files that are tracked in source control from the original folder on your file system to the new one. Note that files not tracked by source control will remain in the original folder - you will probably want to remove this folder once you have confirmed that there are no files there that you need.
  5. Open the solution and select 'No' when prompted to get projects that were newly added to the solution from source control. You will get a warning that one of the projects in the solution could not be loaded.
  6. Select the project within Solution Explorer.

    Note that it will be grayed out and marked as 'Unavailable'.

  7. Open the Properties pane.
  8. Edit the 'File Path' property either directly or using the '...' button.

    Note also that this property is only editable in Visual Studio 2010. In newer versions of Visual Studio, you will need to manually edit the project paths within the solution file.

  9. Right-click on the project in the Solution Explorer and select Reload Project from the context menu. If you get an error message saying that the project cannot be loaded from the original folder, try closing the solution, deleting the suo file in the same folder as the solution file then reopening the solution.
  10. Check in the changes as a single changeset.
  11. Have other team members 'Get latest version' for the solution (right click on the solution within Solution Explorer and select 'Get Latest Version' from the context menu.

Note: Other suggested solutions that involve removing and then re-adding the project to the solution will break project references.

If you perform these steps then you might also consider renaming the following to suit.

  1. Project File
  2. Default/Root Namespace
  3. Assembly

Also, consider modifying the values of the following assembly attributes.

  1. AssemblyProductAttribute
  2. AssemblyDescriptionAttribute
  3. AssemblyTitleAttribute

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...