在App_Code中添加BundleConfig.cs
using System.Web.Optimization;
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/news.css")
.Include("~/common/screen_base.css",
"~/common/screen_news.css"));
bundles.Add(new ScriptBundle("~/bundles/news.js")
.Include("~/script/news_common.js",
"~/script/detail.js",
"~/script/share.js"));
}
}
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/news.css")
.Include("~/common/screen_base.css",
"~/common/screen_news.css"));
bundles.Add(new ScriptBundle("~/bundles/news.js")
.Include("~/script/news_common.js",
"~/script/detail.js",
"~/script/share.js"));
}
}
出现:命名空间“System.Web”中不存在类型或命名空间名称“Optimization”
解决方法 :
通过NuGet添加Microsoft ASP.NET Web Optimization Framework的引用