问题
I'm using Visual Studio 2010 Ultimate, and it seems that I cannot suppress warnings in the way I used in VS2008.
My project is in C#, and when I right click a warning in the "Error List" window (e.g. for a missing XML-comment of a public type), I do not have the usual menu item to suppress this warning (neither in code nor in the global suppressions file).
The project's properties for Code Analysis are
Enable Code Analysis on Build (defines CODE_ANALYSIS constant) => not checked Suppress results from generated code => checked
In the solution's properties for Code Analysis I set all configurations and all platforms to use the "Microsoft All Rules" rule set.
Any ideas why I don't get the menu item anymore? Any help is greatly appreciated,
thanks in advance &
Best regards,
G.
回答1:
I've been trying to get this thing fixed, and somehow it seems to be working again. The problem is that I cannot exactly reproduce what the solution was, but anyway, here is what I tried: - Tools > Customize > Commands > Context menu > Click "Reset All" - Check that under Context menu > "Other Context Menus | Error List" the expected entry for "Suppress message(s)" exists, otherwise add it.
What you also have to keep in mind is that you can only suppress messages generated by FxCop, so a mismatching parameter in source and XML comment cannot be suppressed.
回答2:
I had the same problem. To me it seem to be a little confusing that the "Error list" contains both "Run Code Analysis"-messages and "build projet/solution"-messages. The menu can only appear if the code analysis is run explicitly. The messages in the list are also a little bit different depending there origination. If the "suppress" option should appear in the context menu, the message must start with "CAxxxx ..."
来源:https://stackoverflow.com/questions/3617107/suppress-warning-menuitem-in-visual-studio-2010-is-not-available