第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

是否有一個選項可以在不創(chuàng)建“GlobalSuppressions.cs”文件的情況下停用樣式警察規(guī)則

是否有一個選項可以在不創(chuàng)建“GlobalSuppressions.cs”文件的情況下停用樣式警察規(guī)則

C#
智慧大石 2023-09-09 17:06:41
我們在項目中使用 StyleCop 分析器。我的任務(wù)之一是停用一些規(guī)則,但不創(chuàng)建GlobalSuppressions.cs文件。我找到了解決方案,但僅限于創(chuàng)建此文件,所以我很困惑。
查看完整描述

1 回答

?
翻閱古今

TA貢獻(xiàn)1780條經(jīng)驗 獲得超5個贊

要抑制 之外的警告GlobalSuppressions.cs,您可以:


使用注釋(記得恢復(fù)超出范圍的警告?。?/p>


#pragma warning disable IDE0052 // Remove unread private members

private readonly Object _obj;

#pragma warning restore IDE0052 // Remove unread private members

或SuppressMessage就地使用該屬性


[SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "<Pending>")]

private readonly Object _obj;

如果您想全局禁用它們,可以在解決方案的根目錄下使用.editorconfig文件。


root = true

[*.{cs,vb}]

dotnet_diagnostic.IDE0052.severity = none

您還可以配置規(guī)則集文件,但現(xiàn)已棄用。


在您的 csproj 中:


<PropertyGroup>

? ? <CodeAnalysisRuleSet>File.ruleset</CodeAnalysisRuleSet>

</PropertyGroup>

然后File.ruleset根據(jù)您的需要進(jìn)行創(chuàng)建。看起來大致像


<?xml version="1.0" encoding="utf-8"?>

<RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="10.0">

? <Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">

? ? <Rule Id="CA1056" Action="None" />

? </Rules>

? </Rules>

</RuleSet>


查看完整回答
反對 回復(fù) 2023-09-09
  • 1 回答
  • 0 關(guān)注
  • 137 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號