码迷,mamicode.com
首页 > 其他好文 > 详细

vs 代码分析工具——FxCop analyzers & nuget 包 排除

时间:2020-03-06 19:17:02      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:tar   with   png   project   http   target   dock   dll   docker   

官方文档:Install FxCop analyzers in Visual Studio

1.安装 & 设置成功

技术图片

 

 

2.release版本中删除相关Dll =》项目需要放到docker中,避免每次提交image过大,降低工作效率,故仅在debug时,才加入dll。

2.2.1 方式:编辑项目文件.csproject  

修改相关condition :

其他为程序自动添加;

手动修改部分: And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘ 

 

<Import Project="..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.8\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props" Condition="Exists(‘..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.8\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props‘) And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘ " />
  <Import Project="..\packages\Microsoft.NetFramework.Analyzers.2.9.8\build\Microsoft.NetFramework.Analyzers.props" Condition="Exists(‘..\packages\Microsoft.NetFramework.Analyzers.2.9.8\build\Microsoft.NetFramework.Analyzers.props‘) And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘" />
  <Import Project="..\packages\Microsoft.NetCore.Analyzers.2.9.8\build\Microsoft.NetCore.Analyzers.props" Condition="Exists(‘..\packages\Microsoft.NetCore.Analyzers.2.9.8\build\Microsoft.NetCore.Analyzers.props‘) And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘" />
  <Import Project="..\packages\Microsoft.CodeQuality.Analyzers.2.9.8\build\Microsoft.CodeQuality.Analyzers.props" Condition="Exists(‘..\packages\Microsoft.CodeQuality.Analyzers.2.9.8\build\Microsoft.CodeQuality.Analyzers.props‘) And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘" />
  <Import Project="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.8\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props" Condition="Exists(‘..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.8\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props‘) And ‘$(Configuration)|$(Platform)‘ == ‘Debug|AnyCPU‘" />
  

  

3.release检测:

bin文件夹中,相关dll查询不到了

 

 

 

扩展:

如果condition 条件为or:

Condition="‘$(Configuration)‘==‘Debug‘ Or ‘$(Configuration)‘==‘Release‘"

参考文档:Project reference conditional include with multiple conditions

 

vs 代码分析工具——FxCop analyzers & nuget 包 排除

标签:tar   with   png   project   http   target   dock   dll   docker   

原文地址:https://www.cnblogs.com/panpanwelcome/p/12430099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!