Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refactor, Organize Usings commands missing from Visual Studio context menu

In VS 2010, Silverlight, C#. I have multiple .cs files. In some of them the 'Refactor' and 'Organize Usings' (among other items) in the right-click context menu are missing.

Why are they missing? How can they be brought back?

like image 803
Bob Avatar asked Nov 07 '10 04:11

Bob


3 Answers

I had the same problem after installing ReSharper. "Organize Usings > Remove and Sort" and some other shortcuts were missing in the context menu.

You can still invoke the commands (when availiable) via

Edit > Intellisense > Organize Usings > Remove and Sort

To show them in the context menu again (in case of ReSharper causing the trouble) goto

ReSharper > Options... > Environment > Keyboard & Menus > Menus & Toolbars >
   Uncheck 'Hide overridden Visual Studio Menu items'
like image 177
Jensen Avatar answered Nov 09 '22 11:11

Jensen


Another possibility is that the files without the Refactor option are not in your solution. I have seen this when I was unintentionally looking at files in a different repository branch.

like image 24
RyanR Avatar answered Nov 09 '22 11:11

RyanR


I had this same issue today and the problem was caused by a merge error where additional data had been added to the .csproj file unintentionally.

<Compile Include="DataQueries\Custom\General\CustomImageQueries.cs" />
<Compile Include="DataQueries\Custom\General\CountryQueries.cs" />
<Compile Include="DataQueries\Custom\General\CurrencyQueries.cs" />
<Compile Include="DataQueries\Custom\General\CustomApplicationQueries.cs" />
<Compile Include="DataQueries\Custom\General\CustomFileQueries.cs" />
<Compile Include="DataQueries\Custom\General\CustomImageQueries.cs" />

The CustomImageQueries.cs entry had been added twice to the .csproj file and once the duplicate entry was removed, the IDE worked as expected.

like image 1
80bower Avatar answered Nov 09 '22 13:11

80bower