Copying and Renaming Visual Studio VB.NET Projects
Copying and Renaming Visual Studio VB.NET Projects
It's actually easy, but at first it can appear confounding. Here (IMHO) is a good checklist, to make it easy and to make sure no step is missed.
Disclaimer: This list is for a VB.NET 2010 projects. My apologies, but I can't verify if the same list applies to C# or C++, or earlier versions of VB.NET.
Revision 2:
As suggested, I have revised this post based on comments submitted, and have moved the complete checklist into the attached PDF File.
Thanks to submissions by
(1) WCCRoberts correction for item 21.
(2) OCD Dan regarding app root folder.
(3) RosarioM regarding <Global.System.ComponentModel> and this link.
(4) Bellhop regarding databases.
Download the attached file, and print it out for your checklist.
Good Luck
kdsdata
Last edited by kdsdata; Dec 12th, 2013 at 01:17 PM.
Reason: comments submitted to this post
Re: Copying and Renaming Visual Studio VB.NET Projects
Hmm, what's so difficult? I just copied all the files from the solution folder to a new location and opened it there. All paths to the project files (except external references) are stored relative to the 'root' path of the project.
And it's easier to rename the project when it's opened.
Re: Copying and Renaming Visual Studio VB.NET Projects
Hello cicatrix,
You are correct in saying that you can copy the project folder and just rename the folder, and then rename the the project when the solution is open in VS.
However, that does not clean up items such as the sub folder and the paths of any of your references to the "new" sub path. It also does not change the filenames for the "build" files.
I am aware that my submitted checklist seems long, but it's actually not really that bad to go through, and "all" the references get changed to the new name. 2 minutes and you are done.
I will add that the checklist is all predicated on having all the refrences AND files under the one (new) "project" root folder.
If any files are "external" to the project root folder, then the checklist would be somewhat different. However, if the sub folder, and some of the files have the old project name (or parts of it), then you will need steps something like the checklist.
Re: Copying and Renaming Visual Studio VB.NET Projects
I have some confusion when I hit step 22. Deleting the new project that was just added doesn't make any sense to me. Are you supposed to add the project back at any point? Could you please clarify the last 6 steps?
Re: Copying and Renaming Visual Studio VB.NET Projects
Thanks so much WCCRoberts for picking up on that.
It is item 21 that has an error and should read:
21. Via the Solutions Explorer, right-click the Project (generally the first line below the Solution), and select "Rebuild".
Now items 22 to 26 make sence again.
The corrected pdf file is attached.
Thanks for the pointer,
kdsdata
Revision:
Have removed the attachment (r1) from this comment. See attachment rev 2 in original post.
Last edited by kdsdata; Dec 12th, 2013 at 01:14 PM.
Re: Copying and Renaming Visual Studio VB.NET Projects
kdsdata: I'm sure that your solution works, but not for me! I'm accessing numerous SQL Server Compact Edition databases using Datasets and Table Adapters. After I completed your steps and hit "Rebuild", I got gazillions of errors all relating to the Databases. The work has only just begun! I guess that we'll be sticking with the project "code name" for the time being. That's Sales: It takes them as long to come up with one product name as it takes Engineering to write and debug the entire system, then they complain about how much work it was!
Take-away: If you're using Databases, you'll have more work to do.
Re: Copying and Renaming Visual Studio VB.NET Projects
I know this sounds dumb, but I'm trying to figure out which folders are app root and app sub folders, I'm gussing the root would be something like WindowsApplication1 but the sub folder, I'm really unsure of, any help would be great, thanks!
Re: Copying and Renaming Visual Studio VB.NET Projects
If possible - I think you should EDIT the initial post on this thread ... folks MIGHT miss the corrected information if they don't scroll down the whole page.
Just my 2 cents - thanks.
Originally Posted by kdsdata
Thanks so much WCCRoberts for picking up on that.
It is item 21 that has an error and should read:
21. Via the Solutions Explorer, right-click the Project (generally the first line below the Solution), and select "Rebuild".
Now items 22 to 26 make sence again.
The corrected pdf file is attached.
Re: Copying and Renaming Visual Studio VB.NET Projects
If you need to do this for a VSTO project the namespace field is disabled and officially MS says you can't rename the project. I was able to find this post that explains how to do it. The only additional change I had to make was in this section of code: <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Just change the old name to the new name. I was able to build and run the renamed solution.
Re: Copying and Renaming Visual Studio VB.NET Projects
Hello kdsdata, I hope you are still on this thread.
I have two little problems: a. I don not know which is that app sub folder. I have 4 sub folders: bin, my project, obj and resources. Which one is?
B. What is that .suo file to delete?
I opened the project to rename, I have gotten the error message, but the project did not open, therefore, I could not remove or add a thing.
Re: Copying and Renaming Visual Studio VB.NET Projects
This is excellent information. I've been all over the internet trying to figure out how to systematically copy an existing Visual Basic (2010) project to a new project name. There are a lot of posts out there but, in my experience at least, this is the only one that actually works.