Copy a project in Visual Studio 2010

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

Copying the project folder to another path and opening it leads to the following error.

Error

I am only interested in solutions that will not include more than 1 simple action . I am creating a simple console project, which I am going to copy many times, and am not very fond of going into the settings and repeating several steps every time when such simple things need to be done.

I am using Visual C ++ Express 2010 . Pay attention to the project structure below. I created it as an empty project and added 1 main.cpp file to it.

Project structure

The project was created using the settings .

The project in explorer looks like this .

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

  • opening an old project;
  • pressing the "Copy" button in the menu;
  • closing the old project;

Copying the parent folder of the solution will work, but this creates an unnecessary folder that I will have to move in every copied project every time I need to access the copied project. I would like to avoid unnecessary pass-through folders.

Please note that when creating the project, the checkbox "Create a directory for the solution" was not checked, see the link above. If this has been verified, this will result in 2 unnecessary pass-through folders. There is a folder solution folder , where the solution is created and the project folder . By checking the box, you will get rid of the project folder, and the project files are created in the solution directory, which still leaves the other 2 - I would like to have one for the reasons above.

+6
source share
5 answers

It would be nice if you could just copy the vcxproj file, but you cannot. The problem is that the project files contain a GUID that globally uniquely identifies this project in Visual Studio; Internally, projects usually refer to their GUID, rather than their name. When you copy a project file, you copy the GUID without changing it, which will not work. Please note that both the vcxproj file and any sln files will refer to the GUID, so you can not add it to any sln files until the GUID is changed.

The GUID section of the project file is as follows:

<ProjectGuid>{830DD595-EAD5-475B-9360-E4C2FD7CCC53}</ProjectGuid> 

This line occurs exactly once in the actual vcxproj file. Any solution outside the IDE for copying projects will need to manually change the GUID. The only way to do this in one step is to write yourself a tool that changes the GUID - although finding and replacing with a good editor can be quite fast. You may find the UuidCreate() function useful. Note that directly editing the vcxproj file is also useful if you need to change absolute paths to relative, etc.

Or, of course, you can simply manually copy them using a tool in Visual Studio; the reason it exists is probably the way to automate the GUID rework you need to do. Note that for our own projects, I often use Notepad to edit project files, although Notepad ++ or UltraEdit is an even better idea.

+7
source

It would seem that you have strange requirements that are usually absent, for example, no additional folders, copying only with 1 , etc.

I would suggest writing a simple / script application to do this for you, then you can just click β€œrun” in that application.

Application may

Always copy from a specific template folder. Automatically move the conductor to a new solution, or even better, open a new solution for you?

If you need help, answer.

+4
source

copy the entire folder to / projects, such as C: \ Users \ Username \ Documents \ Visual Studio 2010 \ Project \ ProjectName, in another place, for example, on the desktop and open it. This saves the directory and file structure that the project file looks for. I personally often return my entire project directory, and I never had problems copying older than the current project folders.

+3
source

Although I understand that the OP wants a one-step solution, in general, copying the VS2010 C ++ project to another in the solution is a three-step process.

  • Copy the entire project folder to another and rename the folder correctly in Windows Explorer.
  • Rename the project file in the renamed folder
  • In the same VS 2010 solution, Add -> existing project -> open the renamed project file

Hope this helps.

+1
source

the error says that it was not possible to find "c: \ user \ admin \ dropbox \ training @uva \ volume \ train @uva \ void_template \ main.cpp"

and http://dl.dropbox.com/u/33457177/Screenshots/void_template_2011-12-04_22-15-51.png

shows that you put main.cpp in "c: \ user \ admin \ dropbox \ training @uva \ void_template \"

the way is different

so check the .vcxproj file, find or something else, maybe the wrong configuration

0
source

Source: https://habr.com/ru/post/903059/


All Articles