In VS 2010, Silverlight, C#. I have multiple .cs files. In some of them the 'R开发者_运维问答efactor' and 'Organize Usings' (among other items) in the right-click context menu are missing.
Why are they missing? How can they be brought back?
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'
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.
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.
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!
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.
精彩评论