Last post Nov 23, 2012 05:26 PM by arknu
Nov 11, 2012 01:45 PM|Doggy8088|LINK
I was trying to setup a MVC4 project with ASP.NET MVC 4 source code. After I change the project references and Views\web.config file, all the View pages are just can't use Intellisense in the Visual Studio 2012. See below:
But I do can run the ASP.NET MVC website without any problem.
I made a really simple project to descirbe my question. Here is the projects I made to debug with ASP.NET MVC 4 source code:
Here is what I made with my sample project:
1. Download ASP.NET MVC 4 source code from CodePlex.
2. Unzip it to a folder
3. Open Runtime.sln
4. Add a new ASP.NET MVC 4 project from Visual Studio 2012 ASP.NET MVC 4 Basic Project Template named "MvcApplication1"
5. I tried to remove the following references and add it back from current solution's projects:
6. Then change the web.config file under Views folder. Remove all the following text from this file:
7. Then build & run.
This project can be debug & trace & setup breakpoints without any problem, but all the Views just become unable to use Intellisense.
Does anyone can help?
Nov 12, 2012 05:42 AM|DarrellNorton|LINK
The Razor configuration sections should still be version 220.127.116.11. Make sure the following are in your web.config:
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
Nov 12, 2012 06:38 AM|Doggy8088|LINK
HI DarrelNorton, It doesn't works. After change to your recommandation, the Razor can't run any more. Please check the following error message:
Server Error in '/' Application.
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the
context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_184.108.40.206__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
in the context 'Default' at location 'G:\Temporary ASP.NET Files\root\f55ec8f5\e3d2a456\assembly\dl3\051a9d90\dc0c2fdc_c9c0cd01\System.Web.WebPages.Razor.dll'.
Nov 12, 2012 03:33 PM|Doggy8088|LINK
This problem is confuse me for a long time. Hope someone could help me, thanks.
Nov 23, 2012 01:22 PM|imran_ku07|LINK
This seems to be an issue/bug with Visual Studio. When you try to use a non-GAC MVC(or WebPages) assembly in Views/web.config then VS cshtml intellisense will think that this cshtml file is a cshtml web page(which is maininly used in WebMatrix and it's inherit
from System.Web.WebPages.WebPage) instead of a MVC view which inherit from System.Web.Mvc.WebViewPage. A quick way to resolve this issue is to add these lines in every MVC view,
Update: I was also able to debug your ditto sample solution by following simple steps available at
Nov 23, 2012 05:26 PM|arknu|LINK
I believe I am suffering from this issue, though in an Umbraco site. Umbraco has now added MVC support, but only v3. So I compiled a custom build with MVC4 instead. It works just fine - apart from the intellisense part of things... The frustrating thing
is that I have previously managed to get it working - but I can't remeber exactly what I did, it just suddenly decided to start working.