Gloria
Gloria

Reputation: 1325

The type or namespace name 'ViewPage' does not exist in the namespace 'System.Web.Mvc'

I have a solution (VisualStudi0 2013) that worked perfectly well until couple of days ago. Suddenly after I had restarted my computer I started getting the following error locally everytime I run the debugger. There are no errors in the solution itself but only in the browser. I'm able to clean, build, rebuild and publish the solution without any problems. In fact the solution works well on-line but not locally on my computer.

Another fact is that the aspx files are debugged without any error. It's only the pages that are served with MVC that throws this error.

I searched for the ViewPage and it only exists in the web.config.

pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX"

I'm certain that the ViewPage is available in the solution references under the 'System.Web.Mvc' but why I'm getting this error in a file in the Temporary ASP.NET Files. I cleared the temp files but it didn't help.

Compiler Error Message: CS0234: The type or namespace name 'ViewPage' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)

Source Error:

Line 136: public class views_home_index_aspx : global::System.Web.Mvc.ViewPage, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {

Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\6f597118\63e8eef9\App_Web_index.aspx.a8d08dba.6ujukvge.0.cs Line: 136

Upvotes: 0

Views: 1153

Answers (1)

graham mendick
graham mendick

Reputation: 1839

That was caused by a Security Update. I fixed it by setting CopyLocal to true on the System.Web.Mvc reference but you can get more details at http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx

Upvotes: 5

Related Questions