Hi,
My current solution for renaming the project folder is:
- Remove the project from the solution.
- Rename the folder outside Visual Studio.
- Re-add the project to the solution.
Is there a better way?
Hi,
My current solution for renaming the project folder is:
Is there a better way?
Currently, no. Well, actually you can click the broken project node and in the properties pane look for the property 'Path' then click the small browse icon and select the new path.
Voila :)
There is no simple, one-click way of doing it. Not from within Visual Studio, anyways.
There is another way doing this, using the *.sol, *csproj files.
it will be like this (relative to the *.sol file):
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shani.Commands.Impl", "Shani.Commands.Impl\Shani.Commands.Impl.csproj", "{747CFA4B-FC83-419A-858E-5E2DE2B948EE}"
and just change the first part to the new diretory for example:
Impl\Shani.Commands.Impl\Shani.Commands.Impl.csproj
of course don't forget to move the whole project to that directory
Have fun.
To clarify Mortens solution:
NOTE: This fix is for Visual Studio 2008, but should work here.
.sln
file located in the parent folder..sln
file. Click Yes..sln
file has the same name as the folder. Not required, but maintains consistency.) DONE.
In andersjanmyr's answer its easier to rename the project first.
Also, after those steps are carried out you might want to rename other references to your old project name.
In project properties, update the Assembly Name and Default Namespace. This will update the following in the project file...
<RootNamespace>SomeProjectName</RootNamespace>
<AssemblyName>SomeProjectName</AssemblyName>
...and will get rid of the error "Namespace does not correspond to file location, should be: 'SomeProjectName'"
Rename your root namespace (if you have resharper right click the Namespace and go Refactor -> Rename).
Change all occurences of your old project name in AssemblyInfo.cs
a. Close the solution and the IDE
b. In Explorer: Change the directory name to the new name.
c. In Explorer: Open the .sln file with a text editor.
c. Change the directory name to the new name and save.
d. Restart the IDE and open the solution from the File, Recent Files menu if it doesn't start automatically.
e. Click on the Project folder of the Solution Explorer and check the path property in the properties at the bottom. It will now be referencing to the new project folder.
It worked for me.
@andersjanmyr's Solution: you may press Alt+Enter to bring up the Properties Page for the unavailable project and set the "File Path" property there; since it is not available in the right-click_context-menu of the unavailable project (in VS2008).