我有一个大问题。我创建了一个 MVC 5 项目,但无法使用默认代码启动它。问题出在 bundle 上。它停止在 Global.asax.cs/Application_Start
方法的 BundleConfig.RegisterBundles(BundleTable.Bundles);
行上。
它显示“找不到方法:'!!0[] System.Array.Empty()'。” (系统.MissingMethodException)。
这是BundleConfig.cs
代码(默认):
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
我正在使用 VS 2015 预览版。我应该做什么/改变什么?
谢谢!
最佳答案
正如 Mrchief 在评论中所说,问题是由于针对 .NET 4.6 进行编译造成的,但这不是错误:如果您愿意,可以在服务器上部署 4.6 RC 运行时。如果您在 Azure 中运行,则在 4.6 正式发布(即不是 RC)之前,此选项可能不可用。
来自http://blogs.msdn.com/b/dotnet/archive/2015/05/08/targeting-the-net-framework-4-6-rc.aspx :
your app will require the .NET Framework 4.6 (or later) to run. You will need to deploy the .NET Framework 4.6 RC
目前最安全的做法是不要以 4.6 为目标,除非您确实需要它。
关于asp.net-mvc - MVC 5 bundle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29020614/