0

我按照这个非常简单的教程来创建 MVC4 项目。但它一直给我这样的错误:
The name 'Styles' does not exist in the current context. @Styles.Render("~/Content/themes/base/css", "~/Content/css")
我该怎么办?

4

2 回答 2

0

MVC4 actually doesn't provide this by default if you used the empty project template. You need to get a NuGet package and add a namespace for your Razor views:

  1. Install-Package Microsoft.AspNet.Web.Optimization
  2. Open ~\Views\Web.config
  3. Add an <add namespace="System.Web.Optimization" /> under configuration/system.web.webPages.razor/pages/namespaces
  4. Rebuild & run. It should work.

It has nothing to do with Twitter.Bootstrap except that Twitter.Bootstrap suggests that you use an Empty project template

于 2012-09-28T02:29:15.947 回答
0

正如 Sherbrow 提到的,检查您是否安装了 MVC4 和最新版本。因为我认为 beta 对这两个包的语法与 RC 和 RTM 版本不同。打开你的 nuget 包配置并确保项目确实引用了 RTM 文件。

于 2012-09-01T15:08:45.243 回答