Let's assume we're working on a project called MyProject. I'd like to be able to change its name to MyProject2 AND have its folder name also renamed to MyProject2.
Is this possible from Visual Studio? If not, how to make this happen "outside" it?
To rename a solution: In Solution Explorer, right-click the project, select Rename, and enter a new name. In Solution Explorer, right-click the project and select Properties. On the Application tab, change the "Assembly name" and "Default namespace".
Step 1: Solution Name and Project Name Just click on the solution item in Solution Explorer twice (but do not double click) to get an editable field and then type the new name. In most of the cases your project name will match your solution name so just repeat the steps on the project item instead of the solution.
Rename your project to your new name. It will change the .csproj file automatically which in 2010 is the name of the project. Close Visual Studio. Rename the directory.
Open your solution file to change directory now. Your solution file will point to the new project but will reference the wrong directory.
Before:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stackoverflow_4560662_Rename", "Stackoverflow_4560662\Stackoverflow_4560662_Rename.csproj", "{7CCD10BF-48BA-44E2-B071-D4ED8067ACA1}"
After
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stackoverflow_4560662_Rename", "Stackoverflow_4560662_Rename\Stackoverflow_4560662_Rename.csproj", "{7CCD10BF-48BA-44E2-B071-D4ED8067ACA1}"
Notice the two parts "Stackoverflow_4560662\Stackoverflow_4560662_Rename.csproj" becomes "Stackoverflow_4560662_Rename\Stackoverflow_4560662_Rename.csproj"
This is the only way I've been able to rename a directory for a project. I hope someone finds a better answer.
Following may be one solution
Check answer
How do I rename a Project Folder from within Visual Studio?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With