0

I once attempted to change my project's default namespace in Project -> Project Name Properties -> Default namespace and it messed up so many things I'm now freaked out about trying to do it again (I ended up reverting to the previous namespace).

I don't remember exactly what got messed up but some of these things were references to resource files and configuration files (this application is already installed on other user's PCs, and this namespace change would come with an update, and I'm not sure what would happen with their already existing configuration files or settings files since these are XML's with references to the old namespace).

Is there an easy to follow step by step safe way to perform this change or tool that will help me do it or should I just abandon the idea?

1
  • Using a tool like Resharper that's designed for refactoring jobs is also a good route to go. I can't tell you how many times it saved my ass to be able to change a project's default namespace, select the project in solution explorer, right click, and 'Resolve Namespaces'. It does a really thorough job of ensuring that everyone is updated throughout the solution. Just a note for anyone else looking at this question Jan 11, 2014 at 7:13

1 Answer 1

1

Its never easy, but not bad. I do the following steps and then recompile over and over and fix the remaining errors until it all works.

  1. I change the default namespace in the project.

  2. Use the refactor tool in VS to refactor the existing namespace. It does a decent job.

  3. All resource files will have to be set to "no code generation" then saved and then back to internal/public to get the new namespace.

  4. I do a find on the entire solution looking for the old name space and fix manually. Usually config files.

  5. Fix all T4 templates and run the code generation.

  6. Compile and fix all the missed references.

  7. After it builds and works, you have to test/fix your deployment job/strategy/process. This can be the hardest part depending on the technologies you use or the amount of clients that need updated.

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.