加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 在Debug构建期间禁用SonarLint分析

发布时间:2020-12-15 23:41:20 所属栏目:百科 来源:网络整理
导读:是否可以(在Visual Studio中使用SonarLint扩展)在Debug构建期间禁用Sonar分析器,但是在Release版本中是否启用它们?原因是将解决方案连接到SonarQube大大增加了构建时间. 解决方法 如果我在调试配置中从Visual Studio中构建解决方案,我最终修改了.csproj文件
是否可以(在Visual Studio中使用SonarLint扩展)在Debug构建期间禁用Sonar分析器,但是在Release版本中是否启用它们?原因是将解决方案连接到SonarQube大大增加了构建时间.

解决方法

如果我在调试配置中从Visual Studio中构建解决方案,我最终修改了.csproj文件以删除分析器.这样,sonarlint不会抱怨规则已经过时,也不会受到更新的影响.我从 here得到了答案

<Target Name="DisableAnalyzersForVisualStudioBuild"
        BeforeTargets="CoreCompile"
        Condition="'$(BuildingInsideVisualStudio)' == 'True' And '$(BuildingProject)' == 'True' And '$(Configuration)' == 'Debug'">
  <!--
    Disable analyzers when building a project inside Visual Studio. Note that analyzer behavior for IntelliSense purposes is not altered by this.
  -->
  <ItemGroup>
    <Analyzer Remove="@(Analyzer)"/>
  </ItemGroup>
</Target>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读