Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Renaming folders in SVN and VS.Net

I'm using subversion and Visual Studio 2008 (and Tortoise)

I've got a number of folders in visual studio projects that I want to rename.

Whenever I've tried this in the past I've ended up with conflicts and had to create my new folder, copy all the existing content in to it, check it in and delete the old folder.

Has anyone come across a more straightforward way to do this, or have a set reliable process for renaming folders in Visual studio and Subversion?

thanks in advance,

Chris.

like image 916
ChrisV Avatar asked Jun 19 '09 09:06

ChrisV


People also ask

How do I rename a folder in SVN?

If you want to do a simple in-place rename of a file or folder, use Context Menu → Rename... Enter the new name for the item and you're done.

How do you rename a VS project?

Right-click on the project name & click reload the project. Then rename the project name as highlighted below & save. It will automatically rename the . csproj file.

How do I rename an entire project in Visual Studio?

Visual Studio is not competent at renaming things. Open the project folder in any good text editor. Search-and-replace across the whole folder and replace and text occurrences of the old name with the new name. Sublime Text and Atom have a tree view where you can right click -> Search in folder.


2 Answers

TortoiseSVN has a feature to help with moves and renames performed outside SVN, after the fact.

Rename the folder as you would normally. Then right-click the root folder and select TortoiseSVN -> Check for modifications. In that list you'll see "oldfoldername missing" and "newfoldername unversioned". Ctrl-click on both of them, then right-click and select "repair move".

This way, you can rename folders and files with the benefit of VS's refactoring tools, but without messing up SVN.

like image 188
Rytmis Avatar answered Sep 21 '22 04:09

Rytmis


There are two solutions. The first one:

  1. You right click on the folder in in Visual Studio, and pick "Exclude from project"
  2. You rename the directory with Subversion / TortoiseSVN / whatever (of course, you have to rename the folder with the rename command of a subversion client, otherwise you will end up in trouble)
  3. You add the folder to the in Visual Studio project again

Second approach: You download some SVN plugin for Visual Studio such as VisualSVN or AnkhSVN and use them to rename the folder safely in Visual Studio.

like image 31
Tamas Czinege Avatar answered Sep 20 '22 04:09

Tamas Czinege