如何将项目移动到Visual Studio中的不同文件夹?在我的项目中,我习惯了这种结构。

-- app
---- Project.Something
---- Project.SomethingElse

我想将整个命名空间SomethingElse重命名为SomethingNew,最好的方法是什么(无需手动进入.sln文件)?


当前回答

关闭解决方案并将项目移动到新的文件夹/位置 重新打开溶液 项目应该加载的'+'叹息指的是未检查的部分。所有的文件 将显示为“重命名”。 如果重新打开后不工作,右键单击项目,然后单击卸载 重新加载。 它在VS2019中有效

其他回答

在VS 2015

在解决方案资源管理器中卸载项目 创建一个新的解决方案 将项目复制到新解决方案的文件夹中 右键单击解决方案,添加现有项目。 如果使用MVC等框架,则可能需要在引用管理器中添加引用。

我也有同样的问题。我解决了移动参考,在不到15分钟,没有改变参考。

对我来说,解决办法很简单:

Move your files where you need. Delete the folder with name .vs. Must be as not visible folder. Open the solution file (.sln) using a simple editor like note or notepad++. 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. Save the file with the changes. Open the project file (.csproj) and do the same, remove or add the reference. Save the changes. Open the 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}"

在项目文件中:

原: 新: 原始参考: …\ lib \ RCWF \ 2018.1.220.40 \ TelerikCommon.dll 新的参考: . . \ lib \ RCWF \ 2018.1.220.40 \ TelerikCommon.dll

我希望Git中的更改显示为移动/重命名,而不是删除和添加。 所以我把上面的文章和这篇文章结合起来。

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

并通过文本编辑器从sln文件中的nuget Pkg中调整项目和组件的路径。

使用解决方案文件夹将相关项目分组在一起

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

在visual studio community 2019中,我做了Victor David Francisco Enrique说的,但只需要删除.vs invisible文件夹