code大量的,我已经看到这个参考:
Lots of code that I have seen reference this:
@section Scripts { @Scripts.Render("~/bundles/jqueryval") }这是伟大的,它的工作......如果东西是包括在内。我一定要添加一个引用得到这些?使用的NuGet?复制一个DLL?哪里这是从哪里来的?
Which is great, and it works...if "something" is included. Do I have to add a reference to get these? Use NuGet? Copy a DLL? Where does this come from?
当我跑我的项目,我得到一个404为该资源。
When I run my project, I get a 404 for that resource.
推荐答案您需要创建包。这通常是在你的ASP.NET MVC 4项目 App_Start \\ BundleConfig.cs 文件来完成。它在捆绑和微小的所有解释。
You need to create the bundle. This is often done in the App_Start\BundleConfig.cs file in your ASP.NET MVC 4 project. It is all explained in Bundling and Minification .
在 BundleConfig 类,你需要像这样(此方法应该在的Application_Start 执行):
In the BundleConfig class you need something like this (this method should execute in Application_Start):
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.unobtrusive*", "~/Scripts/jquery.validate*")); // ... more registrations ... }JavaScript源文件中的脚本文件夹是否存在应。以上链接的教程介绍了如何版本在缩小的发布版本等捆绑在一起。
The javascript source files should exists in the Scripts folder. The tutorial linked above explains how minified versions are bundled in the release build etc.
更多推荐
ASP.Net MVC 4捆绑
发布评论