I've just started up on an old project, which was written with MVC2...
Only a small amount of the front end was started, so I decided to use MVC3 and Razor view engine. I created a simple controller and view 开发者_如何转开发and went to view the site within Cassini but it just keeps telling me:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'WebMatrix' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 22: using System.Web.WebPages;
Line 23: using System.Web.WebPages.Html;
Line 24: using WebMatrix.Data;
Line 25: using WebMatrix.WebData;
Line 26:
Source File: c:\Users\XXXXXX\AppData\Local\Temp\Temporary ASP.NET Files\root\ecf08653\deea7194\App_Web_index.cshtml.e70a5900.x4np9ici.0.cs Line: 24
As far as im aware WebMatrix is just a bundle of IIS/Sql Server and some other gubbins that im not interested in. I have not explicitly installed WebMatrix (unless it was bundled within MVC3 installer, and even then I cant find it on my harddisk).
Ive gone through my project and removed any and all traces I could find of WebMatrix and cleared the ASP temp files, but it keeps complaining, so im wondering if they have made MVC reliant upon some web matrix functionality?
Razor is part of the WebMatrix package, and MVC 3 is totally dependent on the ASP.NET Web Pages framework. WebMatrix.WebData includes the SimpleMembershipProvider, and is dependent on WebMatrix.Data. What version of MVC3 are you using? Not RC2? If so, see this thread: asp.net MVC webmatrix membershipprovider kicking in
Also if you install the Visual Studio 11 Developer Preview it will kill MVC Razor in your VS2010.
The CTP seems to be the key factor as any version of the Async CTP also kills MVC Razor. So any MS CTP preview needs to be in a VMWare or PC-VM session as getting back to where you were will tale longer than it did just to install Visual Studio 11 Developer Preview or Async CTP. Seeing that the error is consistent, it seems to be thatanything 4.5 .NET is going to be very different as you move from C# 4.0 to C# 5.0 and Visual Studio 11 is not likely to come out till Nov 2012.
精彩评论