【问题标题】:Does ASP MVC3 NEED Webmatrix?ASP MVC3 是否需要 Webmatrix?
【发布时间】:2010-12-30 19:23:22
【问题描述】:

我刚刚开始了一个旧项目,它是用 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 矩阵功能?

【问题讨论】:

  • 不应该这样。使用没有 webmatrix 的 Mvc3 RC1。

标签: asp.net-mvc webmatrix


【解决方案1】:

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

【讨论】:

  • 我已经删除了会员配置,但它仍然在抱怨。我不确定我是否在 RC1 或更早版本上,所以我要卸载所有与 MVC 3 相关的库并重新安装 RC2,如果这可行,会将其标记为答案。
  • 是的,已卸载,重新打开 RC2 即可正常工作...非常感谢!
【解决方案2】:

另外,如果你安装 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 月才会问世。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-06
    • 2012-01-27
    • 2021-07-26
    相关资源
    最近更新 更多