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

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

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


当前回答

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

其他回答

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

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

在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.

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

我试了很多次,直到找到一个可行的方法。例如,您想要将项目从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,意思是“复制子目录”。此选项自动包含空目录。”

享受! !: -)

通过在“解决方案资源管理器”窗口中右键单击项目并选择“删除”,可以从解决方案中删除项目。移动整个项目文件夹,包括您想要移动的子目录。将项目添加回解决方案。

命名空间名称则完全不同,只需编辑源代码即可。