I'm currently writing a little cmd line app that will take an entire visual studio solution, copy it to a new folder and change the namespaces of all the projects.
Looks like its goin开发者_JS百科g to take some regex magic to get this working properly (and quite a bit of effort).
Am I reinventing the wheel? - is there anything in visual studio or anywhere else that will do this for me?
Thanks in advance!
I use Search and Replace when I need to change namespace of an entire solution, and to move to another directory... I just delete the project and open it again from source control in a different directory (if you don't use a SCM tool, just copy the root of the project and whatever beneath it to the new location)
all paths should be relative to the root.
Refactor->rename doesn't work? It won't move it to a new directory but will find all references and change them.
Unfortunately, this is not a simple search-replace, and this gets tricky even when done with simple refactoring provided by Visual Studio. For example, you can start the refactoring by selecting the namespace you want to rename. But if you have any resource strings or assembly settings, you're probably going to be surprised that even if the application compiles, it may not find the resources at runtime. Sometimes, it's as simple as opening that resource or settings file in a text editor (not on Visual Studio), and correcting the culprit string. However, it may be worse trying to accomplish this by hand (or via a custom-made script).
精彩评论