XamDev
XamDev

Reputation: 3657

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?

Upvotes: 5

Views: 14113

Answers (2)

senz
senz

Reputation: 879

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.

Upvotes: 13

Thomas Weller
Thomas Weller

Reputation: 59643

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

enter image description here

Upvotes: 4

Related Questions