Renaming(All) an existingc# project in Visual Studio 2010
-
Tuesday, June 05, 2012 1:31 PMHi all,
I have a c# solution named "SolutionA" having two projects named-"SolutionA and SolutionAHost".I want to rename the solution to SolutionB and its projects to SolutionB and SolutionBHost.Also want to change corresponding assembly,Link,Outputype,others which are necessary,
can anyone help?
thanks.
regards,
mylife.smile- Moved by CoolDadTxMVP, Moderator Tuesday, June 05, 2012 2:15 PM IDE related (From:Visual C# General)
All Replies
-
Tuesday, June 05, 2012 1:48 PMright click in visual studio and choose 'rename'.
-
Tuesday, June 05, 2012 2:15 PMModerator
FYI that renaming from Solution Explorer won't also rename the folder structure that VS set up. Depending upon the project type it might not also rename the project or solution files, just the display name. You have to do this manually via Windows Explorer. Also note that you'll then need to edit the solution file manually to fix up the path and project file names.
Furthermore you'll need to edit each project's properties to change the generated assembly name and the default namespace. Be aware however that any auto-generated code that has already been added may continue to use the older namespace information so you'll have to fix them as well. EF comes to mind here. Also note that any embedded resources have to be fixed. When you mark a resource as embedded it uses the default namespace of the project (in combination with the file path) to build the resource name. This is done when the item is inserted into the project. Most people remove the resources and add them back to ensure the resources have the correct namespace name.
Next you'll need to edit the assembly info files to use the correct assembly name.
Finally you'll want to rename all your existing namespaces to use the new name. To do this you can go to one of the code files, right click on the section of the namespace (in the namespace statement) that you want to change, right-click and select Refactor\Rename. You can only change a single section at a time.
Michael Taylor - 6/5/2012
http://msmvps.com/blogs/p3net
- Proposed As Answer by Alexander SunModerator Wednesday, June 06, 2012 7:42 AM
- Marked As Answer by Alexander SunModerator Tuesday, June 26, 2012 8:25 AM
-
Monday, June 25, 2012 8:12 PM
I never tried this tool but give it a try, it may do what you want to do. Please take a backup of entire solution before doing anything...
http://normankosmal.com/wordpress/?p=54
Disclaimer: I'm not promoting this software, I don't even tried this before. I'm just suggesting this tool which I found over the internet. Kindly use it at your own risk.

