为什么 resharper 重构(移动)功能不更新引用 - 我可以启用此功能吗?

发布于 2024-12-21 00:50:32 字数 110 浏览 3 评论 0原文

.net 新手,在被 Eclipse 宠坏多年后,喜欢 resharper 的重构功能。然而,当我移动类型时,它似乎不想调整项目的引用以适应?有什么方法可以启用它吗?当然,如果它能提出问题,它就能解决它!?

New to .net and loving resharper's refactor capability after many years of being spoilt by Eclipse. When I move types however it doesn't seem to want to adjust references of the project to suit?? Is there some way to enable it? Surely if it can suggest the problem it can fix it!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

趴在窗边数星星i 2024-12-28 00:50:32

不确定你的意思。默认情况下,Resharper 重构(移动)不会更新要移动的类的命名空间。这意味着无论你把它放在哪里,它都将存在于旧的命名空间中。

但是,您可以将光标放在命名空间上,然后按 Alt-ENTER 键将其更新为给定文件夹结构的正确命名空间,或者指定您自己的命名空间,此时它将更新对的所有引用班级

Not sure what you mean. By default Resharper refactor (move) doesn't update the namespace of the class you are moving. That means that regardless of where you put it, it will exist in the old namespace.

However, you can place your cursor over the namespace, and Alt-ENTER it to update to the proper namespace given the folder structure, or specify your own, and at that point it will update all the references to the class

╰ゝ天使的微笑 2024-12-28 00:50:32

当您在项目之间移动类时,应该使用“移动到文件夹”,但它只能修复名称空间。 ReSharper 不会导入对已移动类的项目的引用。最好的办法是在移动类之前手动导入引用,然后 ReSharper 应该将 using 语句添加到类文件中。

You should use "Move to Folder" when you are moving classes between projects but it will only fix namespaces. ReSharper will not import references to projects for moved classes. Best thing to do would be to import references by hand before moving classes, then ReSharper should add using statements to class files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文