相关疑难解决方法(0)

如何为MVC-3-converted-to-4 app添加对System.Web.Optimization的引用

我正在尝试在我最近从MVC 3转换为MVC 4 beta的项目中使用新的捆绑功能.它需要global.asax中的一行代码BundleTable.Bundles.RegisterTemplateBundles();,这需要using System.Web.Optimization;在顶部.

当我这样做时,我得到了红色的波浪形线条,上面写着:"你错过了一个装配参考吗?" 当我尝试添加引用,并单击对话框中的.NET选项卡时,从AZ排序,我没有看到System.Web.Optimization.

如何将此ref添加到我的项目中?谢谢.

namespaces asp.net-mvc-4 asp.net-optimization

455
推荐指数
6
解决办法
37万
查看次数

MVC Razor在VS 2013/2015/2017中查看了Intellisense

我有一个用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)

asp.net-mvc intellisense visual-studio razor

47
推荐指数
7
解决办法
5万
查看次数