Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change namespace for entire project in VS 2017

Previously some of the classes were present in MyProject.Web.Core project, which are moved to MyProject.Model project. However these moved classes have namespace as MyProject.Web.Core.

So, how can I change the namespace for all classes to MyProject.Model as we don't want to update them manually. Is there any option available in VS2017 ?

We have already update the default namespace in project properties, so that will be get applied when new class is added. But, how about for the moved/old classes?

like image 711
XamDev Avatar asked Aug 16 '17 05:08

XamDev


2 Answers

Set your cursor into the namespace and then hit F2 to rename (if F2 didn't work, try CTRLR + CTRLR or rightclick - rename). All related namespaces should be changed.

like image 117
senz Avatar answered Oct 08 '22 19:10

senz


This is a case where Jetbrains Resharper can help you. It identifies namespace mismatches and allows fixing it solution-wide.

enter image description here

like image 23
Thomas Weller Avatar answered Oct 08 '22 19:10

Thomas Weller