本文介绍了使用NSubstitute的项目的代码分析CA0001错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(.NET 4)测试项目,该项目引用(.NET 4)NSubstitute.dll.

I have a (.NET 4) test project which references (the .NET 4) NSubstitute.dll.

当我对项目运行CodeAnalysis时,我收到许多CA0001错误:

When I run CodeAnalysis against the project I get a number of CA0001 errors:

运行代码分析...

MSBUILD:错误:CA0001:规则= Microsoft.Interoperability#CA1404,目标= arcplan.test.engage.admin.ecmFramework.CAppSettingsTest.#IsSettingsStoreReadyToUse_SettingsStoreIsNotReady_ReturnsFalse():在读取模块"ECMFrameworkTest"时遇到以下错误:方法位置0的参数无效.

MSBUILD : error : CA0001 : Rule=Microsoft.Interoperability#CA1404, Target=arcplan.test.engage.admin.ecmFramework.CAppSettingsTest.#IsSettingsStoreReadyToUse_SettingsStoreIsNotReady_ReturnsFalse() : The following error was encountered while reading module 'ECMFrameworkTest': Method type parameter in position 0 is not valid.

MSBUILD:错误:CA0001:Rule = Microsoft.Security#CA2122,Target = arcplan.test.engage.admin.ecmFramework.CAppSettingsTest.#IsSettingsStoreReadyToUse_SettingsStoreIsNotReady_ReturnsFalse():读取模块"ECMFrameworkTest"时遇到以下错误:方法类型位置0的参数无效.

MSBUILD : error : CA0001 : Rule=Microsoft.Security#CA2122, Target=arcplan.test.engage.admin.ecmFramework.CAppSettingsTest.#IsSettingsStoreReadyToUse_SettingsStoreIsNotReady_ReturnsFalse() : The following error was encountered while reading module 'ECMFrameworkTest': Method type parameter in position 0 is not valid.

(等)

有人知道如何解决这个问题吗?

Does anyone know how to solve this?

推荐答案

您是否正在使用1.4.1版?此版本的版本存在由在安装了.NET 4.5的情况下使用ilmerge .自NSubstitute 1.4.2版(此评论的最新版本)以来,此问题已修复.

Are you using version 1.4.1? The build of this version had a problem caused by using ilmerge with .NET 4.5 installed. This is fixed as of version 1.4.2 of NSubstitute (the latest release as of this comment).

有关更多详细信息,请参见致力于解决此问题的.

More details are available on the commit to fix this.

这篇关于使用NSubstitute的项目的代码分析CA0001错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-24 13:07