Visual Studio Copy Project

前端 未结 12 751
暗喜
暗喜 2020-12-04 07:02

I would like to make a copy of my project. I would rather not start doing it from scratch by adding files and references, etc. Please note that I don\'t mean copy for deploy

相关标签:
12条回答
  • 2020-12-04 07:34

    It is highly NOT ADVISABLE to copy projects at all because the some config files formed internally like .csproj, .vspscc etc. may (and most probably will) point to references which belong to previous solutions' location and other paths/locations in system or TFS. Unless you are an expert at reading these files and fixing references, do not try to copy projects.

    You can create a skeletal project of the same type you intend to copy, this creates a proper .csproj, .vspscc files. Now you are free to copy the class files,scripts and other content from the previous project as they will not impact. This will ensure a smooth build and version control (should you choose to be interested in that)

    Having said all this, let me give you the method to copy project anyhow in a step-wise manner:

    1. Go to the project you want to copy in solution explorer and right-click.
    2. Now select 'Open Folder in File Explorer' (Assuming you have the solution mapped to a local path on your disk).
    3. Select the Projects you want to replicate as whole folders(along with all dependencies,bin .vspscc file, .csproj file)
    4. Paste them in your desired location (it could be your same solution folder or even another solution folder. If it is within the same solution folder, then you would be required to rename it, also the .csproj and other internal files to the new name).
    5. No go back to Visual Studio, Right-Click on Solution > Add > Existing Project...
    6. Browse and select the Project file (.csproj file) now from the location you placed it in and select 'open'
    7. This file now appears in the solution explorer for you to work.

    You may now have to resolve a few build errors probably with duplicated/missing references and stuff but otherwise it's as pristine in logic and structure as you expected it to be.

    0 讨论(0)
  • 2020-12-04 07:42

    I have a project where the source files are in in a folder below the project folder. When I copied the project folder without the source folder and opened the copied project, the source files are not missing but found at the old location. I closed the project, copied also the source folder, and re-opened the project. Now, the project magically references the copied source files (both the new path showed up on "save as" and a change in a file has been saved in the copied version).

    There is a caveat: If not both old and new project folders are below a used library folder, the above-mentioned magic discards also the absolute reference to the library and expects it under the same relative path.

    I tried this with VS Express 2012.

    0 讨论(0)
  • 2020-12-04 07:44

    My solution is a little bit different - the computer that the package resided on died and so I was forced to recreate it on another computer.

    What I did (in VS 2008) was to open the following files in my directory:

                      - <package name>.djproj
                      - <package name>.dtproj.user
                      - <package name>.dtxs
                      - <package name>.sln
                      - Package.dtsx
    

    When I did this a popup window asked me if the sln file was going to be a new solution and when I clicked 'yes' everything worked perfectly.

    0 讨论(0)
  • 2020-12-04 07:47

    Following Shane's answer above (which works great BTW)…

    You might encounter a slew of yellow triangles in the reference list. Most of these can be eliminated by a Build->Clean Solution and Build->Rebuild Solution.

    I did happen to have some Google API references that were a little more stubborn.

    Trying to reinstall the NuGet package of the same version didn't work.
    Visual Studio thinks you already have it installed.

    To get around this:
    1: Write down the original version.
    2: Install the next higher version...then uninstall it.
    3: Install the original version from step #1.

    0 讨论(0)
  • 2020-12-04 07:48

    If you want a copy, the fastest way of doing this would be to save the project. Then make a copy of the entire thing on the File System. Go back into Visual Studio and open the copy. From there, I would most likely recommend re-naming the project/solution so that you don't have two of the same name, but that is the fastest way to make a copy.

    0 讨论(0)
  • 2020-12-04 07:49

    After trying above solutions & creating copy for MVC projects

    For MVC projects please update the port numbers in .csproj file, you can take help of iis applicationhost.config to check the port numbers. Same port numbers will cause assembly loading issue in IIS.

    0 讨论(0)
提交回复
热议问题