none
Visual Studio 2010: Copying a project

    Question

  • Is there an easy way to copy a project in Visual Studio 2010?

    Copying a folder with project to a different path and opening it results in the following error.

     

    I'm interested only in solutions that would not involve more than 1 simple action. I'm creating a simple console project that I'm going to be copying hudreds of times, and not really a fan of going into settings and repeating multiple steps every time such a simple things needs to be done.

    I'm using Visual C++ Express 2010. Note the project structure below. I created it as an Empty Projectand added 1 single file main.cpp to it.

    The project was created using the settings.

    The project in explorer looks like this.

    There is a Copy Project function, but this means more than 1 manual action:

    • openning the old project;
    • pressing Copy on the menu;
    • closing the old Project;

    Copying a parent folder of a solution would work, but that creates an unnecessary folder that I'd have to navigate in each copied project every time I need to access the copied project. I would like to avoid any unnecessary "pass-through" folders.

    Note that create directory for solution was unchecked when the project was created, see the link above. If this was checked it would result in 2 unnecessary pass-through folders. There is a solution folder,folder where solution is created and a project folder. By unchecking the checkbox you get rid of project folder and project files are created in the solution directory, that still leaves the other 2 - I would like to have one for the reasons above.

     

    • Moved by Alexander Sun Tuesday, December 06, 2011 7:05 AM Visual C++ problem (From:Visual Studio Setup and Installation)
    Sunday, December 04, 2011 11:01 PM

Answers

  • Hi,

    I've tried the following.

    1. Under "C:\Projects" create a Visual Studio project named "temp_project" (using similar settings as in the screenshot in the question).
    2. Add a Source File "main.cpp" to the project.
    3. Copy "temp_project" folder to another folder "C:\Project\Volumes", so the full path of the copy is "C:\Project\Volumes\temp_project"

    4. Open the project at the new location (works).
    5. Click on "main.cpp" Source File. Doesn't work and gives an error message similar to above.

    Also tried enabling Fallback Location and setting it to temp or a specified directory. Tried removing the ipch folder, and and *.sdf files, but that still wouldn't work. The message says that the copy of the project is trying to locate *old* "main.cpp", not the new one.

    Still stuck with this issue.

    The same issue is reported on Stack Overflow, but the best answer so far is to create a script to copy a project.

    It was suggested that "The only way you're going to get this down to a single step is to write yourself a tool that changes the GUID".

    Thanks,
    Leonid 



    • Edited by Leeeon Saturday, December 10, 2011 11:41 AM
    • Marked as answer by Rob Pan Tuesday, December 20, 2011 7:13 AM
    Saturday, December 10, 2011 11:35 AM

All replies

  • Hi Leeeon,

     

    Welcome to the MSDN forum.

     

    I am sorry this queue is about Visual Studio Setup and Installation. Your problem is related to Visual C++, so I will move your thread to Visual C++ forum for better support.

     

    Sorry for any inconvenience.

     

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, December 06, 2011 7:05 AM
  • Hi,

     

    The ipch folder is created by the IntelliSense system and it's location cannot be changed on a per-solution basis. However, you can have VS 2010 store all of your projects' ipch folders in your %TEMP%\VC++ folder. Select Tools > Options > Text Editor > C/C++ > Advanced. Once there, you'll see a Fallback Location section. Change Always Use Fallback Location to True. Leave Fallback Location blank and it will put them in your %TEMP% folder. Once you've changed that, you can remove your ipch folder and your *.sdf & *.opensdf files. They will be recreated in the fall-back location. Note, you may want to backup those files if you're picky about the window layout, etc for the project.

     

    In addition, I have copied  a solution to a different folder directly  without the error like yours. So could you please provide more detail about your issue? Or can you check that you have the correct right to copy your folder from C:?

     

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us

    • Edited by Rob Pan Thursday, December 08, 2011 8:30 AM
    Thursday, December 08, 2011 8:29 AM
  • Hi,

    I've tried the following.

    1. Under "C:\Projects" create a Visual Studio project named "temp_project" (using similar settings as in the screenshot in the question).
    2. Add a Source File "main.cpp" to the project.
    3. Copy "temp_project" folder to another folder "C:\Project\Volumes", so the full path of the copy is "C:\Project\Volumes\temp_project"

    4. Open the project at the new location (works).
    5. Click on "main.cpp" Source File. Doesn't work and gives an error message similar to above.

    Also tried enabling Fallback Location and setting it to temp or a specified directory. Tried removing the ipch folder, and and *.sdf files, but that still wouldn't work. The message says that the copy of the project is trying to locate *old* "main.cpp", not the new one.

    Still stuck with this issue.

    The same issue is reported on Stack Overflow, but the best answer so far is to create a script to copy a project.

    It was suggested that "The only way you're going to get this down to a single step is to write yourself a tool that changes the GUID".

    Thanks,
    Leonid 



    • Edited by Leeeon Saturday, December 10, 2011 11:41 AM
    • Marked as answer by Rob Pan Tuesday, December 20, 2011 7:13 AM
    Saturday, December 10, 2011 11:35 AM