Visual Studio move project to a different folder

前端 未结 15 2589
野的像风
野的像风 2020-11-30 18:41

How do I move a project to a different folder in Visual Studio? I am used to this structure in my projects.

-- app
---- Project.Something
---- Project.Someth         


        
相关标签:
15条回答
  • 2020-11-30 19:05

    I had the same problem. I solved with move the references and in less than 15 minutes, without change the references.

    For me the solution was simple:

    1. Move your files where you need.
    2. Delete the folder with name .vs. Must be as not visible folder.
    3. Open the solution file (.sln) using a simple editor like note or notepad++.
    4. Change the reference where your file is, using the following structure: if you put your project in the same folder remove the previous folder or the reference "..\"; if you put in a above folder add the reference "..\" or the name of the folder.
    5. Save the file with the changes.
    6. Open the project file (.csproj) and do the same, remove or add the reference.
    7. Save the changes.
    8. Open the solution file.

    Examples:

    In solution file (.sln)

    • Original: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PATH1.UI", "ScannerPDF\PATH1.UI\PATH1.UI.csproj", "{A26438AD-E428-4AE4-8AB8-A5D6933E2D7B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PATH1.DataService", "ScannerPDF\PATH1.DataService\PATH1.DataService.csproj", "{ED5A561B-3674-4613-ADE5-B13661146E2E}"

      New: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PATH1.MX.UI", "PATH1.MX.UI\PATH1.UI.csproj", "{A26438AD-E428-4AE4-8AB8-A5D6933E2D7B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PATH1.DataService", "PATH1.DataService\PATH1.DataService.csproj", "{ED5A561B-3674-4613-ADE5-B13661146E2E}"

    In project file:

    • Original:

      New:

      Original reference: ....\lib\RCWF\2018.1.220.40\TelerikCommon.dll

      New reference: ..\lib\RCWF\2018.1.220.40\TelerikCommon.dll

    0 讨论(0)
  • 2020-11-30 19:06
    1. Close your solution in VS2012
    2. Move your project to the new location
    3. Open your solution
    4. Select the project that failed to load
    5. In the Properties tool window, there an editable “File path” entry that allows you to select the new project location
    6. Set the new path
    7. Right click on the project and click reload
    0 讨论(0)
  • 2020-11-30 19:10

    Group related projects together using solution folders

    See http://msdn.microsoft.com/en-us/library/vstudio/c6c756s6(v=vs.100).aspx

    0 讨论(0)
  • 2020-11-30 19:11

    I tried the suggestion to remove and re-add the project, but then fixing up dependencies can be a pain.

    I use this approach:

    1. Move the project folder.
      • If the project is in source control, do the move using source control commands.
    2. Edit the solution file in a text editor. There should be only one path that you need to change.
    0 讨论(0)
  • 2020-11-30 19:11

    In VS 2015

    1. Unload your project in the solution explorer
    2. Create a new solution
    3. Copy the projects to the new solution's folder
    4. Right click the solution, add existing project.
    5. If you use some framework such as MVC, you may need to add the reference in the reference manager.
    0 讨论(0)
  • 2020-11-30 19:14

    I wanted the changes in Git to be shown as moves/renames instead of delete & adds. So I did a combo of the above and this post.

    mkdir subdirectory
    git mv -k ./* ./subdirectory
    # check to make sure everything moved (see below)
    git commit
    

    And adjust the paths of the projects and of the assemblies from the nuget Pkg's in the sln file via a text editor.

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