In this post, we will change the name of the existing solution and project to a new name. This is helpful when you have cloned some repository code and want to rename it to a suitable name.
- Visual Studio
Download link is available in Downloads page.
Rename Solution and Project
I have an existing code opened in Visual Studio. The existing name is
WebApplication3. I want to change this name on both solution and project to
Right click on the solution and click on Rename. Similarly, do it for the project as well.
Sometimes, after you rename, there will be a yellow warning marker on the Dependencies. It is absolutely fine. If you see the marker, just restart the visual studio and open the project again. It will go away.
Now, after changing the name, it is time to change the namespace. Open any class file and check that, the namespace would still be pointing to the old project name.
To change it to new name at all the places of the whole solution, click on
Cntrl+F. Mention the old name and click on the dropdown button.
Enter the new name in the second input box. Make sure to check
Match Whole Word, select Entire Solution from the dropdown and finally click on
With this, all your references are now changed to a new name in whole solution.