Random DevTools Entry: #013

Wow, it’s been a looong time since I’ve added one of these.  I have a whole backlog of tools that I could add, but let’s get to one of the important ones:

One of the really annoying things about Visual Studio is that renaming a project in the IDE doesn’t change the name of the directory in the file system (or your source control).  Of course, updating the string in the code files is not so bad, but then you also have to go through all of the project and solution files to change all of those occurrences.

That’s where the _REPLACE.EXE utility comes in.  Using a series of commands like the following:

_replace.exe “<old-string>” “<new-string>” /i /s /ext=.csproj
_replace.exe “<old-string>” “<new-string>” /i /s /ext=.sln
_replace.exe “<old-string>” “<new-string>” /i /s /ext=.cs
_replace.exe “<old-string>” “<new-string>” /i /s /ext=.resx
_replace.exe “<old-string>” “<new-string>” /i /s /ext=.config
_replace.exe “<old-string>” “<new-string>” /i /s /ext=.xml

You can pretty much replace most of the string names in your project by using that set of commands (and additional ones for any other file extensions).  What’s cool is that you can also use the /t command line switch to do a dry run.

Very handy indeed.  Do keep in mind that you still have to go in and manually change the directory names but it’s far more efficient than twiddling around with a text editor to replace the string in each of the project/solution files.

You may also like...