How to change the namespace of a C #

11

The project was created with the name Windows and I want to change it. The problem is that if I simply right click on the project and rename it, the project gets full of error. I tried changing the Assembly name and Default namespace but it also causes a lot of error.

What is the correct way to rename? if possible.

    
asked by anonymous 14.01.2016 / 16:49

1 answer

11

I do this as follows:

  • Ctrl + Shift + H ;
  • Find what: "using Windows;" or "Windows namespace"
  • Replace with (Replace with): "using NewNameNamespace;" (attention to keep the semicolon signs at the end), or "namespace NewNamespaceName";
  • Find in (Look in): Entire Solution.

Some tools do this for you, like ReSharper, but it's not free, so that would be the no-cost way.

Assembly Name and Default Workspace :

The reasoning is the same. First change the names in the properties, then perform the procedure described above, because the namespaces rename is not automatic.

    
14.01.2016 / 16:52