如何从VS2012中的简单Nuget安装中解决MVC4 Twitter Bootstrap项目失败?
我在使用Twitter引导程序启动MVC4应用程序时遇到问题。
在VS 2012中,我创建了一个新的空MVC4应用程序,安装了以下软件包:
- 安装包twitter.bootstrap.mvc4
- 安装包twitter.bootstrap.mvc4.sample
看起来像一些导航路线选项相关的问题,因为我正在经历这些少数的turorials Link 1和Link 2 。
在阅读有关可能的编译问题的说明时,我重新启动了解决方案,但我收到的错误不是自述文件中的错误,而是集中在NavigationRouteOptions
, NavigationRouteFilters
, RouteValueDictionary
, FilterToken
和HasFilterToken
:
'System.Web.Routing.RouteValueDictionary' does not contain a definition for 'HasFilterToken' and no extension method 'HasFilterToken' accepting a first argument of type 'System.Web.Routing.RouteValueDictionary' could be found (are you missing a using directive or an assembly reference?) ...\AdministrationRouteFilter.cs 18 'System.Web.Routing.RouteValueDictionary' does not contain a definition for 'FilterToken' and no extension method 'FilterToken' accepting a first argument of type 'System.Web.Routing.RouteValueDictionary' could be found (are you missing a using directive or an assembly reference?) ..\AdministrationRouteFilter.cs 20 The name 'NavigationRouteFilters' does not exist in the current context 'NavigationRouteOptions' could not be found (are you missing a using directive or an assembly reference?)
我已经确认我确实安装了navigationroutes.mvc4
Nuget包。
这仅适用于VS 2013吗?
Nuget套餐的日期为2013年10月26日。
援助表示赞赏
似乎已经讨论了github中的错误
尝试卸载1.1.100并按以下顺序安装1.0.90版本。
- PM> Install-Package twitter.bootstrap.mvc4.sample -Version 1.0.90
- PM> Uninstall-Package twitter.bootstrap.mvc4.htmlhelpers -Force
- PM> Install-Package twitter.bootstrap.mvc4.htmlhelpers -version 1.0.90
- PM>卸载 – 包twitter.bootstrap.mvc4 -Force
- PM> Install-Package twitter.bootstrap.mvc4 -version 1.0.90
早上好,我遇到了完全相同的问题,至少对我来说,这个工作>
而不是安装twetter.bootstrap,只需安装bootstrap包,因为它看起来像vs2013的版本,他们只是将包交给MS维护。
所以,卸载你当前的bootstrap版本(twitter一个),然后安装一般的bootstrap。 (或确保安装3.0.2版)
install-package bootstrap
请注意,此修复程序适用于VS2k12。
对我来说,这个关于如何设置ASP.NET MVC 4和Twitter Bootstrap的教程工作正常: https : //www.macaw.nl/weblog/2013/5/setting-up-a-solution-with-mvc4-and-twitter -bootstrap
如果你创建一个VS2012项目(基本—不是因特网!),然后在bootstrapLayout.basic.cshtml(你会在共享文件夹中找到)中添加css文件,并在底部添加Javascript文件,Muthu的解决方案就有效。 bootstrapLayout.basic.cshtml。 这是我的bootstraplayout.basic.cshtml。 注意……脚本文件的顺序很重要(祝你好运!)……感谢Mithu!
@using System.Web.Optimization @using BootstrapSupport @using NavigationRoutes @ViewBag.Title @**@ @* @Styles.Render("~/Content/bootstrap.min.css") @Scripts.Render("~/bundles/modernizr")*@ @RenderSection("head", required: false) @Html.Partial("_html5shiv") @* favicons and touch icons go here *@ @Html.Partial("_alerts") @Html.Partial("_validationSummary") @RenderBody()
@*@Scripts.Render("~/js")*@ @RenderSection("Scripts", required: false)