locked
How to port a project from a solution to another one? RRS feed

  • Question

  • My coworker already finished a VC# project which is based on a vision platform (by company-1). It contains a solution (solution-1) with only one project (proejct-1). Then I was requested to port it to another vision platform by another vision company (company-2). I've got a sample programs based on company-2's platform, which compose a VC# solution. My idea to port project-1 from solution-1 to solution-2.

    Is this the correct first step? Then, how can I proceed it? The company-2-provided solution contains lots of project, each of which is based on company-2 platform.

    I tried to copy the whole folder of project-1 to solution-2 and added the project-1 to solution-2. It seems not completely correct.

    Friday, September 11, 2020 7:04 AM

Answers

  • I'd like to add to Andrew's suggestion, in the case where you want your namespace in the new solution's project to be different than project-1:

    1. In your solution-2, add a new project.
    2. Copy all of the files for the project from project-1, but *not* the project file itself (the .csproj file). 
    3. Then from your new project in solution-2, choose Add Existing and select and add all those files that you just copied.
    4. You'll also have to change the namespace in each of those files.


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Saturday, September 12, 2020 1:32 AM
  • My coworker already finished a VC# project which is based on a vision platform (by company-1). It contains a solution (solution-1) with only one project (proejct-1). Then I was requested to port it to another vision platform by another vision company (company-2). I've got a sample programs based on company-2's platform, which compose a VC# solution. My idea to port project-1 from solution-1 to solution-2.

    Is this the correct first step? Then, how can I proceed it? The company-2-provided solution contains lots of project, each of which is based on company-2 platform.

    I tried to copy the whole folder of project-1 to solution-2 and added the project-1 to solution-2. It seems not completely correct.

    The way I would do it is not to copy projects around, but instead to right-click on a solution and left-click "Add Existing Project."  Then you browse to the existing project and double-click on its .vcproj file.  Bam - it's now part of your new Solution.

    You need to know that any changes you make to the Project, when it's loaded this way, will be reflected in every other Solution that includes the same Project.

    If you really want to edit the existing Projects without reflecting changes in other Solutions, then go ahead and copy the files via the File Explorer (not copying around in Visual Studio).  After that then you still have to do the same first step - right-click Solution, left-click "Add Existing Project," browse to the copied-in directories and select the .vcproj (or .vbproj or whatever project file you're including).


    Before you can learn anything new you have to learn that there's stuff you don't know.

    Friday, September 11, 2020 6:35 PM

All replies

  • Friday, September 11, 2020 6:30 PM
  • My coworker already finished a VC# project which is based on a vision platform (by company-1). It contains a solution (solution-1) with only one project (proejct-1). Then I was requested to port it to another vision platform by another vision company (company-2). I've got a sample programs based on company-2's platform, which compose a VC# solution. My idea to port project-1 from solution-1 to solution-2.

    Is this the correct first step? Then, how can I proceed it? The company-2-provided solution contains lots of project, each of which is based on company-2 platform.

    I tried to copy the whole folder of project-1 to solution-2 and added the project-1 to solution-2. It seems not completely correct.

    The way I would do it is not to copy projects around, but instead to right-click on a solution and left-click "Add Existing Project."  Then you browse to the existing project and double-click on its .vcproj file.  Bam - it's now part of your new Solution.

    You need to know that any changes you make to the Project, when it's loaded this way, will be reflected in every other Solution that includes the same Project.

    If you really want to edit the existing Projects without reflecting changes in other Solutions, then go ahead and copy the files via the File Explorer (not copying around in Visual Studio).  After that then you still have to do the same first step - right-click Solution, left-click "Add Existing Project," browse to the copied-in directories and select the .vcproj (or .vbproj or whatever project file you're including).


    Before you can learn anything new you have to learn that there's stuff you don't know.

    Friday, September 11, 2020 6:35 PM
  • I'd like to add to Andrew's suggestion, in the case where you want your namespace in the new solution's project to be different than project-1:

    1. In your solution-2, add a new project.
    2. Copy all of the files for the project from project-1, but *not* the project file itself (the .csproj file). 
    3. Then from your new project in solution-2, choose Add Existing and select and add all those files that you just copied.
    4. You'll also have to change the namespace in each of those files.


    ~~Bonnie DeWitt [C# MVP]

    http://geek-goddess-bonnie.blogspot.com

    Saturday, September 12, 2020 1:32 AM