在使用的WebForms捆的精缩/组合的文件输出,即使在调试模式 [英] Using bundles in WebForms outputs the minified/combined file even in debug mode

查看:165
本文介绍了在使用的WebForms捆的精缩/组合的文件输出,即使在调试模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的精缩在一起,我想结合各种脚本文件/包。在隐藏文件我的code(是的,对不起,这是在VB!)我将它添加到< ASP:占位符/> < HEAD> 像这样

I've created a bundle of various script files that I want to be combined/minified together. In my code behind file (yes, sorry it's in VB!) I add it to a <asp:placeholder /> on the <head> like this

Me.PlhHeader.Controls.Add(New LiteralControl(Scripts.Render("~/bundles/main").ToHtmlString()))

这会工作,但它似乎总是输出COM pressed精缩版,甚至当调试=真正的在web.config中。

This will work, but it always seems to output the compressed minified version, even when debug="true" in the Web.Config.

不管是什么,这是什么是输出:&LT;脚本的src =/包/主&GT;&LT; / SCRIPT&GT;

no matter what, this is what is output: <script src="/bundles/main"></script>

什么我需要做的不同,以使这个输出个别uncom pressed文件时在调试模式?

What do I need to do differently to make this output the individual uncompressed files when in debug mode?

修改

我也试过手动设置选项 BundleTable.EnableOptimizations = FALSE ,它的还是的输出一个缩小的脚本标签。我的想法。

I've also tried to manually set the option BundleTable.EnableOptimizations = false and it still outputs the single minified script tag. I'm out of ideas.

我在做一些非常愚蠢的一些相关code,但在技术上与一切束是罚款和正常工作。问题解决了我!

I was doing something very dumb with some related code, but technically everything with the bundles was fine and working correctly. Problem solved for me!

推荐答案

我会建议您安装Microsoft.AspNet.WebOptimization.WebForms。它的作品真的很好。

I would recommend you to install the Microsoft.AspNet.WebOptimization.WebForms. It works really well.

Microsoft.AspNet.WebOptimization.WebForms

然后你可以使用:

<%: System.Web.Optimization.Scripts.Render("~/bundles/main") %>

这篇关于在使用的WebForms捆的精缩/组合的文件输出,即使在调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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