Results 1 to 11 of 11

Thread: Copying and Renaming Visual Studio VB.NET Projects

  1. #1
    New Member kdsdata's Avatar
    Join Date
    Dec 10
    Location
    Calgary, Canada
    Posts
    3

    Smile 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.

    1. Close all VS Projects and VS itself.
    2. Via Windows Explorer make a copy of the (old) Project.
    3. With reference to the new (copied) folder, and with the meaning "rename to the new Project name":
    -> i. Rename the app (root) folder
    -> ii. Rename the app (root)\(sub) folder
    -> iii. Rename the .sln file
    4. Delete the .suo file
    5. Open the new app (rrot)\(sub) folder and "rename" the .vbproj file.
    6. Open VS.
    7. Click <Open Projects...> and point to the new .sln file
    8. You will get the following error message:
    -> "One or more projects in the solution were not loaded correctly.
    -> Please see Output Window for details"
    9. Click <OK> and ignore this message, for the remainder of this checklist.
    10. When the Project opens, Right-Click on the Project in the Solutions Explorer, and select <Remove>
    11. Again, Right-Click in the Solutions Explorer, and select <Add><Existing project...>
    12. Point to, and open, the new .vbproj file in the (new) app (root)\(sub) folder.
    13. Via the Solutions Explorer, check that all files are correctly named and in the correct folders. Starting with the Solution, click each item, going down the list, and inspect the Properties Window, looking for correct names and folders.
    14. However, you are not done renaming the project.
    15. In the Solutions Explorer, Double-Click <My project>
    16. This opens the (new name) Top-Tab. The Left-Tab should be <Application>.
    17. In the fields "Assembly name" and Root namespace", enter the new project name.
    18. From the <File> menu, choose <Close Solution>, and click <OK> in reply to the question "Save changes to the following items:"
    19. The new project should save and close, and should be visible now in VS under <Recent Projects>.
    20. But you are still not done. There is some clean-up to do.
    21. Open the new (renamed) app from the <Start page>.
    22. Via the Solutions Explorer, right-click the Project (generally the first line below the Solution), and select <Remove>.
    23. Assuming the old Project was able to compile, the new Project should also compile, and create the respective files.
    24. Close the app and VS.
    25. Go to the app folder (root)\(sub)\bin\debug and delete the files with the old project name.
    26. Go to the app folder (root)\(sub)\obj\x86\debug and delete the files with the old project name.
    27. Now you are done with copying, renaming, and cleaning up.

    Download the attached file, and print it out for your checklist.
    Good Luck
    kdsdata
    Attached Images Attached Images

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 09
    Location
    Moscow, Russia
    Posts
    3,588

    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.

  3. #3
    Super Moderator Hack's Avatar
    Join Date
    Aug 01
    Location
    Searching for mendhak
    Posts
    58,283

    Re: Copying and Renaming Visual Studio VB.NET Projects

    Moved To Tutorials
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  4. #4
    New Member kdsdata's Avatar
    Join Date
    Dec 10
    Location
    Calgary, Canada
    Posts
    3

    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.

    Regards,
    kdsdata

  5. #5
    New Member
    Join Date
    Feb 12
    Posts
    1

    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?

  6. #6
    New Member kdsdata's Avatar
    Join Date
    Dec 10
    Location
    Calgary, Canada
    Posts
    3

    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
    Attached Images Attached Images

  7. #7
    New Member
    Join Date
    Sep 12
    Posts
    1

    Re: Copying and Renaming Visual Studio VB.NET Projects

    This was very useful. Thanks!!!

  8. #8
    New Member
    Join Date
    Oct 12
    Posts
    1

    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.

  9. #9
    New Member
    Join Date
    Jun 09
    Posts
    2

    Thumbs up Re: Copying and Renaming Visual Studio VB.NET Projects

    Thank you! I have been trying to figure out how to do this for a while now.

  10. #10
    Junior Member
    Join Date
    Nov 10
    Posts
    30

    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!

  11. #11
    New Member
    Join Date
    Jan 13
    Posts
    1

    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.

    Quote Originally Posted by kdsdata View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •