13

Possible Duplicate:
how to rename a project without killing solution

I know that this question has been frequently asked, but none could help me overcome the fear of rendering my application useless by improper renaming of my solution,

I am working on a C# Windows application in VS 2008, as in initial step i was unaware of the fact that renaming is such a big issue in VS, i named the project "stock" but now that my project is nearly completed, my lead wants to rename the namespace to BetRates_NS as that is the name of the deployment setup project,

i even have web service references in my solution and other dependencies with the namespace name, ans based on my previous experience, renaming is not so easy in VS,

so can some1 please give me the exact step by step process to rename my solution so that the application might run smooth now and may not crash at a later point of time due to this.

i am totally hoping for some help here.....thanxx in advance......!!

this is my solution explorer screenie:

enter image description here

Community
  • 1
  • 1
Samy S.Rathore
  • 1,665
  • 3
  • 25
  • 43
  • 2
    possible duplicate of [how to rename a project without killing solution](http://stackoverflow.com/questions/3209002/how-to-rename-a-project-without-killing-solution), [The best way to rename a project in Visual Studio 2008](http://stackoverflow.com/questions/2856338/), [Proper way to rename solution (and directories) in Visual Studio](http://stackoverflow.com/questions/2043618/), [The best way to rename a project in Visual Studio 2008](http://stackoverflow.com/questions/2856338/) [How do I rename a Project Folder from within Visual Studio?](http://stackoverflow.com/questions/211241/) – Cody Gray Aug 09 '12 at 07:49
  • 1
    Right Click on Solution and go for Rename option. – Nikhil Agrawal Aug 09 '12 at 07:49
  • @NikhilAgrawal don't u ever try to do that without proper steps, u'll end up with Vs giving error-"can't open solution, either moved, renamed or deleted" – Samy S.Rathore Aug 09 '12 at 08:01
  • @CodyGray: except the first link, i've seen all else, sorry to be so noob, but they are not very clear and i am afraid if i do something wrong, it will be hazardous – Samy S.Rathore Aug 09 '12 at 08:08
  • 1
    Then do a backup first. You should do a backup *anyway*. – Cody Gray Aug 09 '12 at 08:13

1 Answers1

5

Try this

Press CTRL + H then enter your old name that you wanna change to a new name

by the option look in, you can also choose current project or entire solution

Find and replace

You can also change your namespace in your project properties

Chage namespace or assembly name

** Or you can create a new solution, and add those projects to your new solution and build it

JohnnBlade
  • 4,139
  • 1
  • 19
  • 22
  • Do you wanna change the solution name, or do you wanna change the project name ? – JohnnBlade Aug 09 '12 at 08:12
  • If you wanna change the solution name then you can always, create a new solution, and add those projects to your new solution – JohnnBlade Aug 09 '12 at 08:13
  • i wanna rename both solution, and project, i wanna eliminate the word stock.. – Samy S.Rathore Aug 09 '12 at 08:17
  • @Samy000rathore you sound a little worried. You do have a complete backup of your solution and projects, don't you? – Karl Aug 09 '12 at 08:22
  • @Karl: imma a fresher trainee, and this is my first live project which is nearly ready for beta release...so yes i now backed up my whole solution and gonna try John's way...:P thanxx a lot guys....:) – Samy S.Rathore Aug 09 '12 at 09:05
  • 1
    ok, i shall say, this is not a complete solution, i had to change names for a few folders and errors in my reference.cs files for the web services, but it helped me very much, thanxx john – Samy S.Rathore Aug 09 '12 at 09:44
  • Thats cools man, it was only to get you in the right direction ;) – JohnnBlade Aug 09 '12 at 09:54
  • Yups...that totally kicked me in d right dir' , thanxx a ton bro...^_^ – Samy S.Rathore Aug 09 '12 at 13:28
  • 1
    Yeah as the other duplicate solution shows, you also need to open the sln file in notepad, and rename the path in there ie change "Foo\Lab.csproj" to "Bar\Lab.csproj", otherwise it obviously loses the plot when you rename the solution directory – wired00 Sep 08 '15 at 12:18