Rename the project in Visual Studio 2010 and call Namespacing to match

In Visual Studio 2010, I have an ASP.NET MVC 3 project called blahblah. Thus, all the code in this project is referred to as blah blah. Controllers, blahblah.Configuration, etc.

I want to be able to rename the project to blahblah.Web. Now I know that I can just right-click on the project and proceed to rename, but if I do, none of the name matches will happen anymore.

I would like to somehow transform all namespaces so that this is a relatively new project name. blahblah.Web.Controllers, blahblah.Web.Configuration, etc.

Is there an easy way to do this?

+4
source share
4 answers

Yes, use the ReSharper Refactoring menu and select Customize Namespace. http://www.jetbrains.com/resharper/webhelp/Refactorings__Adjust_Namespaces.html

+7
source

The easiest way is to use Replace in Files or CTRL + SHIFT + H.

Search all previous namespace, for example. namespace blahblah.Web.Controllers and replace with a new namespace, for example. namespace blahblah.Web.Configuration .

Also, remember to change the default namespace in the project properties so that all new files are created in the correct namespace.

+3
source

Without third-party add-ons: Modify> Find and replace> Replace in files

Find that: namespace blahblah
Replace with: namespace blahblah.Web

Click Replace All.

0
source

Using search and replace

Do a search to use the blabble. and replace it with "using blahblah.Web".

Ignore quotation marks to show only a string. That should make it easy enough.

0
source

Source: https://habr.com/ru/post/1402679/


All Articles