Suppress .codeanalysislog.xml and .lastcodeanalysisuccceeded files from getting dropped

做~自己de王妃 提交于 2021-02-07 18:17:46

问题


Is there a way I can suppress .codeanalysislog.xml and .lastcodeanalysisuccceeded from getting dropped in my output directory on build?


回答1:


I agree, the bin folder is bad place for these FxCop files. However suppressing these files from getting generated, or deleting them unconditionally after the build is not the best decision. First, removing .lastcodeanalysissucceededd will cause code analysis re-run even when nothing has changed. Second, removing .CodeAnalysisLog.xml will make it almost impossible to investigate details of analysis errors and warnings. So you might as well just turn off the code analysis for the project.

Instead, let me suggest another solution. It solves the problem with those pesky files in your bin folder, while preserving all functionality of FxCop. The solution is simply put those files somewhere else. The best place is obj folder, i.e. $(IntermediateOutputPath).

Paste this section in your project file after all <import>'s, at the end of the file:

  <PropertyGroup>
    <CodeAnalysisLogFile>$(IntermediateOutputPath)$(TargetFileName).CodeAnalysisLog.xml</CodeAnalysisLogFile>
    <CodeAnalysisSucceededFile>$(IntermediateOutputPath)$(TargetFileName).lastcodeanalysissucceeded</CodeAnalysisSucceededFile>
  </PropertyGroup>



回答2:


Never mind, I put in a post-build target to delete these files

<Target Name="AfterBuild" AfterTargets="Build">    
<ItemGroup>
    <FilesToDelete Include="\**\*.CodeAnalysisLog.xml" />
    <FilesToDelete Include="\**\*.lastcodeanalysissucceeded" />
</ItemGroup>



来源:https://stackoverflow.com/questions/24472559/suppress-codeanalysislog-xml-and-lastcodeanalysisuccceeded-files-from-getting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!