Today I need to rename one of my Project Solution.It is actually complex to do correctly because the project name is used in several places.
Here are the steps you need to follow to rename a solution:
Step 1:
In Solution Explorer, right-click the project, select Rename, and enter a new name.
Step 2:
In Solution Explorer, right-click the project and select Properties. On the Application tab, change the "Assembly name" and "Default namespace".
Step 3:
In the main CS file (or any other code files), rename the namespace declaration to use the new name. For this right-click the namespace and select Refactor > Rename enter a new name. For example:
namespace WindowsFormsApplication1
Step 4:
Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs.
[assembly: AssemblyTitle("New Name Here")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("New Name Here")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
Step 5:
Delete bin and obj directories physically.
Step 6:
Rename the project physical folder directory.
Step 7:
Open the SLN file (within notepad or any editor) and change the path to the project.
Step 8:
Cleans and Rebuild the project
Here it is now your project is completely renamed.
If you found any other step I missed. Please comment here.
Thanks for the tips. They helped :-)
ReplyDeleteGood post!
ReplyDeleteIt helped!
This comment has been removed by the author.
ReplyDeleteSorry. maybe I'm just stupid but what is the main CS file?
ReplyDeleteOpen any .CS file and rename namespace as describe in steps.
DeleteGood post!
ReplyDelete(y)
Thanks.
What if the project is under TFS? Would the mentioned steps change the TFS side information too? Thanks.
ReplyDeletethanks
ReplyDeletefor vb.net should i skip step 3 and 4
ReplyDeletehow about the edmx files??
ReplyDeletethanks for this!!
ReplyDeleteThank you very much sir :)
ReplyDeleteMight be too obvious to mention, but also change the name of the .sln file.
ReplyDeleteMerci !
ReplyDeleteMerci
ReplyDeleteStep 2: Add the point that should change the main method reference as well.
ReplyDeletePerfect post though. Thank you.