Only Bolivian Here
Only Bolivian Here

Reputation: 36753

How can I change the name of my project and have it reflect everywhere?

I created a project in Visual Studio 2010 but I mispelled the name well into development.

If I right click, and rename the project, it seems the changes aren't cascaded to folders and classes.

For example, if my project was named Foa and I added a class, the namespace would be:

namespace Foa
{
    public class Bar

If I renamed the project to Foo, the class stays:

namespace Foa
{
    public class bar

Is there a way to cascade that change?

Upvotes: 0

Views: 2790

Answers (2)

Tim Abell
Tim Abell

Reputation: 11901

Change the default namespace in the project properties, then use a refactor tool to change the namespaces. Resharper has a fix inconsistent namespaces tool that will do it but you can just use the visual studio refactor to do it manually.

Upvotes: 0

Josh M.
Josh M.

Reputation: 27821

Change the namespace in one spot and then Ctrl+. on it and choose the refactor option. This will change the namespace throughout.

Upvotes: 4

Related Questions