使用NSubstitute的项目的代码分析CA0001错误 [英] Code analysis CA0001 error for project using NSubstitute

查看:186
本文介绍了使用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:读取模块"NSubstitute"时遇到以下错误:无法解析类型引用:[mscorlib,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b77a5c561934e089] System.Runtime.CompilerServices. ExtensionAttribute.

MSBUILD : error : CA0001 : The following error was encountered while reading module 'NSubstitute': Could not resolve type reference: [mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]System.Runtime.CompilerServices.ExtensionAttribute.

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版?此版本的版本存在由

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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆