1

我刚刚开始了一个用 MVC2 编写的旧项目......

只启动了少量的前端,所以我决定使用 MVC3 和 Razor 视图引擎。我创建了一个简单的控制器和视图,然后在 Cassini 中查看该站点,但它一直在告诉我:

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 

据我所知,WebMatrix 只是 IIS/Sql Server 和其他一些我不感兴趣的 gubbins 的捆绑包。我没有明确安装 WebMatrix(除非它捆绑在 MVC3 安装程序中,即使那样我也无法在我的硬盘上找到它)。

我已经完成了我的项目并删除了我可以找到的所有 WebMatrix 痕迹并清除了 ASP 临时文件,但它一直在抱怨,所以我想知道他们是否让 MVC 依赖于某些 Web 矩阵功能?

4

2 回答 2

3

Razor 是 WebMatrix 包的一部分,而 MVC 3 完全依赖于 ASP.NET 网页框架。WebMatrix.WebData 包括 SimpleMembershipProvider,并且依赖于 WebMatrix.Data。您使用的是哪个版本的 MVC3?不是RC2?如果是这样,请参阅此线程:asp.net MVC webmatrix membersprovider kicking in

于 2010-12-30T21:00:01.783 回答
1

此外,如果您安装 Visual Studio 11 开发人员预览版,它将在您的 VS2010 中杀死 MVC Razor。

CTP 似乎是关键因素,因为任何版本的 Async CTP 也会杀死 MVC Razor。因此,任何 MS CTP 预览都需要在 VMWare 或 PC-VM 会话中,因为回到原来的位置会比安装 Visual Studio 11 开发人员预览或 Async CTP 更长。看到错误是一致的,当您从 C# 4.0 迁移到 C# 5.0 时,任何 4.5 .NET 似乎都会有很大不同,而 Visual Studio 11 可能要到 2012 年 11 月才会出现。

于 2011-10-23T15:15:31.557 回答