Bob
Bob

Reputation: 381

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?

Upvotes: 38

Views: 9936

Answers (5)

lunair
lunair

Reputation: 289

It appends to me after a 'undo pending change' of an unshelve (TFS). Added files in shelveset opened in editor remain opened after undo, then you cannot access 'Organize Usings' right-click context menu item.

See ya, Lun@ir.

Upvotes: 0

Jensen
Jensen

Reputation: 1329

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'

Upvotes: 65

Dragn1821
Dragn1821

Reputation: 817

I figured my issue out.

I had a XAML workflow file located in the interface project (to allow editing) that I was opening with the file system and passing to another project to process the workflow.

The XAML file had a warning about including System.Runtime even though I had added a reference to System.Runtime.Serialization.

I excluded the XAML file from the project and intellisense and the menu options returned. I then added the file back to the project and they continued to work.

Hope that helps someone!

Upvotes: 0

80bower
80bower

Reputation: 1161

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.

Upvotes: 1

RyanR
RyanR

Reputation: 141

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.

Upvotes: 6

Related Questions