Groups | Blog | Home
all groups > c# > october 2006 >

c# : How to change name of the project?


renu
10/6/2006 11:09:50 PM

Hi,
What options do I have after putting a month in on writing a program
and so many functions in it and now I want to change the name of the
project with their file names?
Do I make the new project and hand copy over all the controls and code
or
is there a big red plastic "easy' button somewhere I can push?
Waiting for your favourable response.
Thanking you.

Renuka
Jani Järvinen [MVP]
10/7/2006 3:24:00 PM
Hello Renuka,

[quoted text, click to view]

If you are using Visual Studio 2005, you can simply open up Solution
Explorer (the "project manager") and rename your project from there.
Alternatively, you could activate the project by selecting it in Solution
Explorer and choosing File/Save MyProject1 As.

However, when you first create your project in Visual Studio, the name of
the project also becomes the default namespace. If you change your project's
name, the namespace won't change. You have to change this using refactorings
(or more manually using the Edit/Find and Replace/Replace in Files command).

As for the files that belong to the project, you have the same alternatives
as renaming the project. That is, the easiest way is to simply rename the
files one by one in Solution Explorer.

Finally, if your solution contains only one project, you might want to also
change the name of your solution in Solution Explorer.

All in all Solution Explorer is your friend here.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
janij@removethis.dystopia.fi
http://www.saunalahti.fi/janij/

Narasimham
10/12/2006 8:00:09 AM
Hi,

Is there some way of being able to rename the project and the namespace
by using command line options. Or do you know if there is a tool
available that I could use.

The basic issue is that I have a template project that can be used by
various people, but when they rename the project, the namespaces dont
automatically change. I am looking to automate this process for the
benefit of the users.

Narasimham

[quoted text, click to view]
AddThis Social Bookmark Button