开发者

Visual Studio - Moving a solution to a new folder and namespace

开发者 https://www.devze.com 2022-12-11 02:51 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号