禁止 .codeanalysislog.xml 和 .lastcodeanalysisuccceeded 文件被删除 [英] Suppress .codeanalysislog.xml and .lastcodeanalysisuccceeded files from getting dropped
问题描述
有什么方法可以抑制 .codeanalysislog.xml 和 .lastcodeanalysisuccceeded 在构建时被放到我的输出目录中吗?
Is there a way I can suppress .codeanalysislog.xml and .lastcodeanalysisuccceeded from getting dropped in my output directory on build?
推荐答案
我同意,bin
文件夹不适合存放这些 FxCop 文件.然而,禁止生成这些文件,或者在构建后无条件地删除它们并不是最好的决定.首先,删除 .lastcodeanalysissucceededd
会导致代码分析重新运行,即使什么都没有改变.其次,删除 .CodeAnalysisLog.xml
将使调查分析错误和警告的详细信息几乎不可能.所以你不妨干脆把项目的代码分析关掉.
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.
相反,让我建议另一种解决方案.它解决了 bin
文件夹中那些讨厌的文件的问题,同时保留了 FxCop 的所有功能.解决方案只是将这些文件放在其他地方.最好的地方是obj
文件夹,即$(IntermediateOutputPath)
.
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)
.
将此部分粘贴到您的项目文件中在所有<import>的
之后,在文件末尾:
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>
这篇关于禁止 .codeanalysislog.xml 和 .lastcodeanalysisuccceeded 文件被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!