MVC 5包错误 [英] MVC 5 Bundle Error

查看:146
本文介绍了MVC 5包错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的问题。我创建了一个MVC 5项目,我不能用默认的code启动它。问题是与捆绑。它停在Global.asax.cs中/ 的Application_Start 方法,在 BundleConfig.RegisterBundles(BundleTable.Bundles); 线。
它说:没有找到方法:'!! 0] System.Array.Empty()'。 (system.missingMethodException而)。

I have a big problem. I created an MVC 5 project and I cannot start it with default code. The problem is with the bundling. It stops in the Global.asax.cs/Application_Start method, on the BundleConfig.RegisterBundles(BundleTable.Bundles); line. It says "Method not found: '!!0[] System.Array.Empty()'." (System.MissingMethodException).

下面是 BundleConfig.cs code(默认):

Here is the BundleConfig.cs code (default):

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 preVIEW。我应该怎么办/改变?

I'm using VS 2015 Preview. What should I do/change?

谢谢!

推荐答案

由于Mrchief在评论中说,这个问题是由于编制针对.NET 4.6,但它的不是一个错误:您可以如果您选择您的服务器上部署4.6 RC运行。如果你在Azure上运行,此选项将可能无法使用,直到4.6正式发布(即非RC)。

As Mrchief says in the comments, the problem is due to compiling against .NET 4.6, but it's not a bug: you can deploy the 4.6 RC runtime on your server if you choose to. If you're running in Azure, this option will probably not be available until 4.6 is officially released (i.e. not RC).

从<一个href=\"http://blogs.msdn.com/b/dotnet/archive/2015/05/08/targeting-the-net-framework-4-6-rc.aspx\">http://blogs.msdn.com/b/dotnet/archive/2015/05/08/targeting-the-net-framework-4-6-rc.aspx:

您的应用程序将需要的.NET Framework 4.6(或更高版本)运行。您将需要部署 .NET框架4.6 RC

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,除非你真的需要它。

Safest for now is to not target 4.6 unless you really need it.

这篇关于MVC 5包错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆