我正在尝试在我最近从MVC 3转换为MVC 4 beta的项目中使用新的捆绑功能.它需要global.asax中的一行代码BundleTable.Bundles.RegisterTemplateBundles();,这需要using System.Web.Optimization;在顶部.
当我这样做时,我得到了红色的波浪形线条,上面写着:"你错过了一个装配参考吗?" 当我尝试添加引用,并单击对话框中的.NET选项卡时,从AZ排序,我没有看到System.Web.Optimization.
如何将此ref添加到我的项目中?谢谢.
我有一个用VS2010编写的现有项目,在VS2010中加载时效果很好.
当我在VS2013中加载同一个项目时,MVC Razor视图包含许多错误,就好像views文件夹中缺少配置文件一样.
它似乎没有使用root和views文件夹中的配置文件正确加载Razor编辑器,而是给我一些错误,如...
The name 'model' does not exist in the current context
Run Code Online (Sandbox Code Playgroud)
和......
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'LabelFor'
and no extension method 'LabelFor' accepting a first argument of type
'System.Web.WebPages.Html.HtmlHelper' could be found
(are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
...
知道是什么会导致这个吗?
编辑:按要求配置文件....
从主web.config文件(不是全部,因为它太大而不能发布)
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" culture="neutral" publicKeyToken="c7192dc5380945e7" />
<bindingRedirect newVersion="3.0.0.0" oldVersion="0.0.0.0-3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Validation" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect newVersion="5.0.505.0" oldVersion="0.0.0.0-5.0.505.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web" …Run Code Online (Sandbox Code Playgroud)