Chr*_*eis 8 mef visual-studio-2010 suppress-warnings
SupressMessage的选项在VS 2010 Pro中不可用吗?
当我右键单击警告列表中的警告时,没有禁止选项.我也尝试了错误,没有选择.然后,我尝试创建自己的GlobalSuppression.cs文件,但不知道警告应归入哪个类别.
现在我正在这样做,这有效,但我更喜欢使用GlobalSuppression文件
#pragma warning disable 0649,0169
[Import(AllowRecomposition = false)]
private IModuleManager _moduleManager;
[Import(AllowRecomposition = false)]
private IRegionManager _regionManager;
[Import(AllowRecomposition = false)]
private IRibbonService _menuService;
#pragma warning restore 0649,0169
Run Code Online (Sandbox Code Playgroud)
这些是我想要抑制的输出窗口的警告:
warning CS0649: Field 'Shell._moduleManager' is never assigned to, and will always have its default value null
warning CS0169: The field 'Shell._regionManager' is never used
warning CS0649: Field 'Shell._menuService' is never assigned to, and will always have its default value null
Run Code Online (Sandbox Code Playgroud)
我想要压制的原因是我的解决方案使用Prism/MEF,因此这些变量在运行时分配.
您看到的CSxxxx警告是C#编译器警告,而不是FxCop /代码分析警告.必须使用#pragma warning disable指令抑制它们,而不是使用SuppressMessage属性.
顺便提一下,集成的代码分析仅适用于Premium或Ultimate,而非Pro.
| 归档时间: |
|
| 查看次数: |
2833 次 |
| 最近记录: |