开发者

ReSharper: Rename namespace not available?

I'm trying to rename a namespace. For some reason, ReSharper isn't giving me the option to do so. I right click on it and choose Refactor, but everything except "Convert" is greyed out. I try the key combination CTRL R + R, and it says the command is unavailable. What am I doing wrong?

Here is documentation suggesting that what I am trying to do should work:

http://www.jetbrains.com/resharper/documentation/help20/Refactoring/renaming.html#renameNamespace

I'm using Visual Studio 20开发者_Go百科08 with R# 4.5


I have come across this before and the answer is very subtle. Do not select (eg by double clicking) the entire method name(or namespace if renaming a namespace). Instead, ensure the method name is deselected and place the caret over the method name. eg

ReSharper: Rename namespace not available?

NOT this

ReSharper: Rename namespace not available?

When you select the Convert menu the items should now be available for methods, and 'Rename' will become available if you had the caret over a namespace. In my mind this should be changed, it is not obvious.


Apparently, the way to do this now is via ReSharper => Refactor => Adjust Namespaces menu or open the Class View, right click on the namespace you wanted to rename and again select Refactor => Adjust Namespaces.

See also: Fastest way to update namespaces with ReSharper?


For what it's worth, I just had this problem. Closing Visual Studio and re-opening it fixed the problem for me. HTH.


This is an old issue but I just had this and perhaps know a workaround. Since someone has commented just yesterday timing could not be more perfect. Anyways, I had the same issue and was finally able to do a rename refactoring on my namespace.

  • I chose one of the classes in my project and did the move to another namespace refactor.
  • Then I was able to go to another class and do the rename namespace refactor.

Perhaps a bug in Resharper that if the namespace is consistent throughout the class then it's disabled? Unlikely since this was reported as far back as 4.5...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜