I added the bundle in BundleConfig.cs as shown below:
我在BundleConfig.cs中添加了bundle,如下所示:
bundles.Add(new ScriptBundle("~/bundles/angular").Include("~/Scripts/angular.min*"));
In the _Layout.cshtml I have the following:
在_Layout.cshtml中,我有以下内容:
<body>
@RenderBody()
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/angular")
@RenderSection("scripts", required: false)
</body>
</html>
In the network traffic it does not show the angular file.
在网络流量中,它不显示角度文件。
3 个解决方案
#1
20
Bundling in ASP.NET MVC is quite clever in that it understands *.min and when to use or no to use it. So if you do this in your bundle:
在ASP.NET MVC中捆绑是非常聪明的,因为它理解* .min以及何时使用或不使用它。因此,如果您在捆绑中执行此操作:
bundles.Add(new ScriptBundle("~/bundles/angular").Include("~/Scripts/angular.js"));
In debug-mode, it will send a request for "/scripts/angular.js"
and in release-mode it will send a request to "/scripts/angular.min.js"
在调试模式下,它将发送“/scripts/angular.js”请求,在发布模式下,它将向“/scripts/angular.min.js”发送请求
In order to benefit from this, you should put both the original and the minified file in your scripts folder. That way, when you're debugging you have full access to the uncompressed source and in your production environment, the optimized file will be loaded
为了从中受益,您应该将原始文件和缩小文件放在脚本文件夹中。这样,当您进行调试时,您可以完全访问未压缩的源并在生产环境中,将加载优化的文件
#2
0
you have given incorrect file name
你给出了错误的文件名
~/Scripts/angular.min*
instead it should be
相反它应该是
~/Scripts/angular.js
.min would automatically be added in the production mode\
.min会自动添加到生产模式中
Bundler not including .min files
Bundler不包括.min文件
#3
0
in my case the problem was with Global.asax.cs
就我而言,问题出在Global.asax.cs上
you need to have
你需要拥有
BundleConfig.RegisterBundles(BundleTable.Bundles);
BundleConfig.RegisterBundles(BundleTable.Bundles);
in your Application_Start()
在你的Application_Start()中
#1
20
Bundling in ASP.NET MVC is quite clever in that it understands *.min and when to use or no to use it. So if you do this in your bundle:
在ASP.NET MVC中捆绑是非常聪明的,因为它理解* .min以及何时使用或不使用它。因此,如果您在捆绑中执行此操作:
bundles.Add(new ScriptBundle("~/bundles/angular").Include("~/Scripts/angular.js"));
In debug-mode, it will send a request for "/scripts/angular.js"
and in release-mode it will send a request to "/scripts/angular.min.js"
在调试模式下,它将发送“/scripts/angular.js”请求,在发布模式下,它将向“/scripts/angular.min.js”发送请求
In order to benefit from this, you should put both the original and the minified file in your scripts folder. That way, when you're debugging you have full access to the uncompressed source and in your production environment, the optimized file will be loaded
为了从中受益,您应该将原始文件和缩小文件放在脚本文件夹中。这样,当您进行调试时,您可以完全访问未压缩的源并在生产环境中,将加载优化的文件
#2
0
you have given incorrect file name
你给出了错误的文件名
~/Scripts/angular.min*
instead it should be
相反它应该是
~/Scripts/angular.js
.min would automatically be added in the production mode\
.min会自动添加到生产模式中
Bundler not including .min files
Bundler不包括.min文件
#3
0
in my case the problem was with Global.asax.cs
就我而言,问题出在Global.asax.cs上
you need to have
你需要拥有
BundleConfig.RegisterBundles(BundleTable.Bundles);
BundleConfig.RegisterBundles(BundleTable.Bundles);
in your Application_Start()
在你的Application_Start()中