Archive for February, 2011

How to rename a project in Visual Studio 2010

February 26, 2011
  • You can rename any project by right-clicking the project in Solution Explorer and select Rename. But this doesn’t change the physical folder name. To change the physical folder name, first right-select “Open Folder in Window Explorer”, then close the solution (File> Close Solution), then rename the folder that contains the project (the folder in which the *.csproj file resides).
  • The assembly name and the namespace of the projects under this solution still remain unchanged (suppose you’ve changed namespaces and/or assembly names for some of them), to fix this, while the solution is still closed, open their individual .csproj file with a text editor and modify the <RootNamespace> and <AssemblyName> nodes to reflect the changes.
  • Last but not least,  When you reopen the solution, VS won’t be able to load the project. To fix this, remove the stale project entry in Solution Explorer, then right-select the Properties of the solution > Add > Existing Project and navigate to select the *.csproj file.