我当前重命名项目文件夹的解决方案是:
从解决方案中删除项目。在Visual Studio外部重命名文件夹。将项目重新添加到解决方案中。
有更好的方法吗?
我当前重命名项目文件夹的解决方案是:
从解决方案中删除项目。在Visual Studio外部重命名文件夹。将项目重新添加到解决方案中。
有更好的方法吗?
当前回答
重命名解决方案和项目文件夹中的项目从解决方案中删除项目将现有项目添加到解决方案(重命名的项目)
它对我有用。TFS还将跟踪新项目。
其他回答
我们最近上传了一个免费Visual Studio扩展的测试版,它为您提供了这些功能。
查看Visual Studio Gallery:Gallery下载
对于Visual Studio 2017,您可以使用我的Visual Studio扩展:
下载
它将在以下位置重命名项目:
项目位置文件夹解决方案文件其他项目中的参考程序集名称、信息默认命名空间
我经常遇到在VisualStudio中重命名项目并编辑文件夹名、项目名和.sln文件以实现这一点的问题。我刚刚写了一个VBScript脚本来完成这一切。您必须小心选择要替换的字符串。
您只需将.vbs文件与解决方案的.sln文件放在同一目录中即可。
' Script parameters'
Solution = "Rename_Visual_Studio_Project" '.sln'
Project = "Rename_Visual_Studio_Project" '.csproj'
NewProject = "SUCCESS"
Const ForReading = 1
Const ForWriting = 2
Set objFso = CreateObject("Scripting.FileSystemObject")
scriptDirr = objFso.GetParentFolderName(wscript.ScriptFullName)
' Rename the all project references in the .sln file'
Set objFile = objFso.OpenTextFile(scriptDirr + "\" + Solution + ".sln", ForReading)
fileText = objFile.ReadAll
newFileText = Replace(fileText, Project, NewProject)
Set objFile = objFSO.OpenTextFile(scriptDirr + "\" + Solution + ".sln", ForWriting)
objFile.WriteLine(newFileText)
objFile.Close
' Rename the .csproj file'
objFso.MoveFile scriptDirr + "\" + Project + "\" + Project + ".csproj", scriptDirr + "\" + Project + "\" + NewProject + ".csproj"
' Rename the folder of the .csproj file'
objFso.MoveFolder scriptDirr + "\" + Project, scriptDirr + "\" + NewProject
转到.sln文件,右键单击,用Notepad++(或任何编辑器;Notepad++是最快的)打开,找到路径并更改它。
这就是我在VS19中重命名现有项目的方式。
关闭visual studio项目重命名并打开驱动器上的每个项目文件夹名称重命名每个.csproj打开.sln文件并重命名每个.csproj事件的项目目录前缀。在visual studio中打开.sln文件并重建通过浏览每个文件或使用ReplaceAll,用新的名称空间引用更新以前的名称空间