change solution file to a different folder

后端 未结 9 1055
遥遥无期
遥遥无期 2021-02-03 18:03

How do I change the folder of my existing solution file (sln)?

It\'s right now inside one of my project\'s folder; if I cut the solution file and paste it in the root fo

9条回答
  •  情歌与酒
    2021-02-03 18:17

    There are two ways you can do it:

    1. Simply delete the entire project and create the entire project again in the other folder ( which is not recommended).
    2. Here are the steps to follow without missing any files.

      a. Goto Source control explorer Create a new folder or Just move the solution to which you want to move the folder to.

      b. Load the solution in your local and it will prompt a message saying that do you want to reload it from source control click yes.

      c. Once we load the solution you will see that the project you have moved won’t be loaded (Since we moved to the other folder)

      d. So now, Remove the project which was not loaded and then add it as an existing project

      e. I am sure that if you have added nugetPackages they won’t get loaded.

      f. Goto file explorer of the particular project open the .csproj file and try to check the packages location, Error condition, Project reference and Import and apart from them if there are any Which are pointing to a directory.

      g. The simplest way is just adding some nuget package and see what is the path generated by visual studio.

      h. Once we change the locations they will be loaded in references

      i. After adding references try to build the solution and it will throw some build errors because we moved the project from one folder to other.

      j. Add the project reference wherever needed after moving the files

      k. Now the build will be succeeded.

提交回复
热议问题