[英]Copying a project in a solution and updating namespaces - Visual studio 2015
I'm trying to copy an entire project within a solution (let's call it project A) in visual studio and update the namespace of all classes contained within the copied project. 我正在尝试在Visual Studio中的解决方案(称为项目A)中复制整个项目,并更新复制的项目中包含的所有类的名称空间。
I can successfully copy the project but I'm not able to update the namespace of all the classes in one operation. 我可以成功复制项目,但是无法通过一次操作更新所有类的名称空间。
Here's what I've tried: 这是我尝试过的:
-Ensuring that VS is closed, navigate to the solution in the file explorer. -确保VS已关闭,请导航至文件资源管理器中的解决方案。 Make a copy of the project A folder and paste it into the solution. 复制项目A文件夹并将其粘贴到解决方案中。
-Rename project A-copy to Project B. -将项目A副本重命名为项目B。
-Navigate to the csproj file in project B -导航到项目B中的csproj文件
-Open the solution in VS > select Add existing project > select the csproj file for project B -在VS中打开解决方案>选择添加现有项目>选择项目B的csproj文件
-With project B displayed in the solution explorer, right click on properties for project B and open. -在解决方案资源管理器中显示项目B后,右键单击项目B的属性并打开。
-At this point the assembly name and the Default namespace are the same as project A. -此时,程序集名称和Default名称空间与项目A相同。
-I've Updated both fields with New values and also updated the assembly information name. -我用新值更新了两个字段,还更新了装配体信息名称。
-After building the project and opening any of the class files. -构建项目并打开任何类文件后。 The name space on all class files is still the same as project A 所有类文件上的名称空间仍然与项目A相同
Does anyone know how I can update the name space on all class files in a single action, without having to manually update the namespace in each file? 有谁知道我可以在一次操作中更新所有类文件的名称空间,而不必手动更新每个文件中的名称空间?
Also tried restarting VS but this did not have any effect. 还尝试重新启动VS,但这没有任何效果。
Does anyone know what I might be doing wrong 有人知道我可能做错了吗
Thanks 谢谢
This question is already addressed in older posts. 这个问题已经在较早的帖子中讨论过了。 I doubt there is no single method to resolve this. 我怀疑没有单一的方法来解决这个问题。 1) You can use Ctrl + H
to replace the old namespace with new one. 1)您可以使用Ctrl + H
将旧名称空间替换为新名称空间。 2) Press F2 to rename the namespace, hope this replaces the old one. 2)按F2键重命名名称空间,希望它能替代旧名称空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.