Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 找不到类型或命名空间名称“ContractClassFor”(是否缺少using指令或程序集引用?)_C#_Wpf_Nunit - Fatal编程技术网

C# 找不到类型或命名空间名称“ContractClassFor”(是否缺少using指令或程序集引用?)

C# 找不到类型或命名空间名称“ContractClassFor”(是否缺少using指令或程序集引用?),c#,wpf,nunit,C#,Wpf,Nunit,我正在使用以下代码 [ContractClassFor(typeof(IWindow))] 如果缺少using指令或程序集引用,为什么找不到类型或命名空间名称“ContractClassFor”的错误?是来了吗?这是因为一个模棱两可的问题。我从引用中删除了Microsoft.Contracts。现在它可以正常工作了。感谢Frebin Francis先生的支持。您是否添加了System.Diagnostics.Contracts命名空间?是的。我添加了System.Diagnostics.Con

我正在使用以下代码

[ContractClassFor(typeof(IWindow))]

如果缺少using指令或程序集引用,为什么找不到类型或命名空间名称“ContractClassFor”的错误?是来了吗?

这是因为一个模棱两可的问题。我从引用中删除了Microsoft.Contracts。现在它可以正常工作了。感谢Frebin Francis先生的支持。

您是否添加了System.Diagnostics.Contracts命名空间?是的。我添加了System.Diagnostics.Contracts命名空间。请尝试将mscorlib.dll添加到项目中。