Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/279.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# ASP.NET类型或命名空间名称';数据';命名空间WebMatrix中不存在_C#_Asp.net_Asp.net Mvc 4 - Fatal编程技术网

C# ASP.NET类型或命名空间名称';数据';命名空间WebMatrix中不存在

C# ASP.NET类型或命名空间名称';数据';命名空间WebMatrix中不存在,c#,asp.net,asp.net-mvc-4,C#,Asp.net,Asp.net Mvc 4,我在上面看到了这个错误,我不知道如何修复它 Compiler Error Message: CS0234: The type or namespace name 'Data' does not exist in the namespace 'WebMatrix' (are you missing an assembly reference?) Source Error: Line 26: using System.Web.Optimization; Line 27: usi

我在上面看到了这个错误,我不知道如何修复它

Compiler Error Message: CS0234: The type or namespace name 'Data' does not exist in the namespace 'WebMatrix' (are you missing an assembly reference?)

Source Error:


Line 26:     using System.Web.Optimization;
Line 27:     using System.Web.Routing;
Line 28:     using WebMatrix.Data;
Line 29:     using WebMatrix.WebData;
Line 30:     

Source File: c:\Users\jsuske\AppData\Local\Temp\Temporary ASP.NET Files\root\4014cfe1\cff16cf6\App_Web_index.cshtml.a8d08dba.ma_nldui.0.cs    Line: 28 

我签出index.cshtml,但没有看到对它的引用,我查看了index.cshtml的控制器,但没有看到对它的引用,我最近将WebMatrix.WebData添加到了我的引用中…我需要添加其他引用吗。我真的不知道这里出了什么问题。

看起来您的项目缺少对WebMatrix.Data的引用

但是,如果不需要WebMatrix.Data,请确保从
\Views\Web.config
中删除其引用:

<system.web.webPages.razor>
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <namespaces>
            ... namespaces ...
            <add namespace="WebMatrix.Data" />
        </namespaces>
    </pages>
</system.web.webPages.razor>

... 名称空间。。。

通过确保引用中包含WebMatrix.WebData,可以修复此错误。另外,清理并重建代码。