user3723240
user3723240

Reputation: 393

ASP.NET The type or namespace name 'Data' does not exist in the namespace WebMatrix

I am getting this error above and I have no clue on how to fix it.

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 

I checked out index.cshtml and I do not see a reference to it, I looked in the controller of index.cshtml and did not see a reference to it, I recently added WebMatrix.WebData to my refernce...do I need to add another reference. I really dont know what went wrong here.

Upvotes: 1

Views: 2197

Answers (1)

Caspian Canuck
Caspian Canuck

Reputation: 1500

Looks like your project is missing a reference to WebMatrix.Data.

However, if you don't need WebMatrix.Data then make sure to remove its reference from your \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>

Upvotes: 1

Related Questions