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

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

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


当前回答

不知道为什么所有的答案都忽略了最简单的解决方案。只需运行“命令提示应用程序”(在窗口栏中搜索CMD,它将自动出现)

然后只需输入以下命令(根据您自己的情况更改路径:)

robocopy /E C:\Users\Peter\source\repos D:\Peter\repos

robocopy所做的是“将文件数据从一个位置复制到另一个位置”,“秘密源”是/ E,意思是“复制子目录”。此选项自动包含空目录。”

享受! !: -)

其他回答

我发现这个方法,这个方法对我有用。

在visual studio 2017社区版中,它在此路径创建一个项目 ”马克C: \用户\ \ \回购\产生来源\产生” 这将产生一个文件访问被拒绝的问题

现在,你可以用这种方法解决这个问题。

close your visual studio process. Then, find your project and copy the project folder But, first make a Sub-folder Named Projects inside of your visual studio 2017 folder in documents. Next, paste the project folder inside of your visual studio 2017 Project folder not the main visual studio 2017 folder it should go into the Sub-folder called Projects. Next, restart Visual studio 2017 Then, choose Open project Solution Then, find your project you pasted in your visual studio 2017 Projects folder Then clean the Project and rebuild it , It, should build and compile just fine. Hope, this Helped out anybody else. Not to sure why Microsoft thought building your projects in a path where it needs write permissions is beyond me.

复制项目文件夹到新目标 从解决方案中删除项目(在“解决方案资源管理器”中右键单击项目并选择“删除”) 然后将现有项目添加到解决方案中(在“解决方案资源管理器”中右键单击项目,选择“添加”,然后选择“现有项目”) 将路径更改为“YourProjectName”中的“packages”文件夹。csproj"文件(在记事本中打开并更改链接包的路径)

最简单的方法,我自己找到的

我试了很多次,直到找到一个可行的方法。例如,您想要将项目从sln文件夹移动到mySource文件夹。

Remove your Project: In the SolutionExplorer of Visual Studio select your Project you want to change the directory, Press Delete -> Project gets removed. It still remains in your sln folder. Copy it to your Path: In the windows explorer copy your whole project to your mySource folder. -> Now you are ready to include it. Include back your Project: In the SolutionExplorer of Visual Studio add Existing Project and select your project from mySource folder. -> Project is now back in your Solution. Adjust your Project References: Check every Reference in your Project. On your Project -> Dependencies -> Project -> you see your project references. If there is a yellow Warning sign on a project reference than is it wrong. Delete your project reference and add it new. Rebuild your Project: and let it Run. Afterwards you can delete your project in the sln folder, which is not anymore in use.

这工作。玩得开心!

不知道为什么所有的答案都忽略了最简单的解决方案。只需运行“命令提示应用程序”(在窗口栏中搜索CMD,它将自动出现)

然后只需输入以下命令(根据您自己的情况更改路径:)

robocopy /E C:\Users\Peter\source\repos D:\Peter\repos

robocopy所做的是“将文件数据从一个位置复制到另一个位置”,“秘密源”是/ E,意思是“复制子目录”。此选项自动包含空目录。”

享受! !: -)

我也有同样的问题。我解决了移动参考,在不到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