ASP.NET MVC 4捆绑在调试模式下JS文件 [英] ASP.NET MVC 4 is bundling js files in Debug Mode

查看:117
本文介绍了ASP.NET MVC 4捆绑在调试模式下JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是,默认情况下,asp.net的MVC没有捆绑在调试模式下的CSS和JS文件。但是,我们的CSS和JS文件都在调试模式越来越捆绑在一起。

"The issue is that, by default, asp.net mvc DOES NOT bundle the css and js files in debug mode. But our css and js files ARE getting bundled in the debug mode."

由于某些原因,所有的CSS和JS文件被捆绑在调试模式。它开始前几天。我们有一个大的团队与几个开发人员和其很难找出在过去几天里发生了什么变化,因为有提交到库一些变化。但是我没有找到在BundleConfig和Global.asax.cs中的任何显著的变化。

For some reason, all the css and js files are being bundled in debug mode. It started few days ago. We have a large team with several developers and its hard to find out what changed in the last few days because there are several changes submitted to the repository. However I didn't find any significant changes in the BundleConfig and Global.asax.cs.

当应用程序在调试模式下运行,BundleTable.EnableOptimizations返回false。

When the application is running in debug mode, BundleTable.EnableOptimizations returns a false.

据我了解,当调试设置为true,那么绑定不会发生。
<编译调试=真targetFramework =4.5>

To my understanding when debug is set to true then bundling does not happen. <compilation debug="true" targetFramework="4.5">

到目前为止,我还没有发现在谷歌这个问题的一个单一的发生。这是一个非常特殊的问题?

So far I haven't found a single occurrence of this issue on Google. Is this a very unique problem?

而不是理想的一种解决办法的,我想解决它。查找原因是这里的实际问题。在哪里我应该开始寻找解决任何指针将AP preciated。谢谢你。

Ideally instead of a workaround I would like to fix it. Finding the cause is the actual problem here. Any pointers on where I should start looking for the fix would be appreciated. Thank you.

编辑:我的问题是相似但不完全相同的<一个href=\"http://stackoverflow.com/questions/11952491/asp-net-mvc-4-app-with-bundling-and-minification-why-is-minification-enabled-in\">ASP.NET MVC 4应用程序与捆绑和缩小,为什么缩小在调试模式下启用?
有人请删除这个问题可能已经有一个答案在这里:标签。
在我的情况下束路径已经开始用〜

My question is similar to but not exactly the same as ASP.NET MVC 4 app with bundling and minification, why is minification enabled in debug mode? Someone please remove the "This question may already have an answer here:" tag. In my case the bundle paths are already starting with a "~"

模板:
@ Styles.Render(〜/内容/ CSS)
@ Scripts.Render(〜/包/ JS)

捆绑配置:
bundles.Add(新包(〜/内容/ CSS),包括(〜/内容/ * CSS));
bundles.Add(新包(〜/包/ JS),包括(〜/脚本/ MyProj文*));

推荐答案

尝试MVC的故障外专。

Try troubleshooting outside of MVC specifically.

请问这个问题现在超越您的整个团队的或只是你的机器?如果它是整个团队至少你知道变化在提交周期某处发生了。

Does this problem now transcend your entire team or just your machine? If it's the entire team at least you know the change happened somewhere in the commit cycle.

你有没有重建的解决方案?正确的清洁?您是否在运行IIS,IIS防爆preS或卡西尼?你是绝对肯定该网站/建造你在调试器中运行是不是在释放模式?你可能会调试一个不被通过共建管道的修改(没有此类别下建立绝对下降)的特定版本。

Have you rebuilt the solution? Cleaned properly? Are you running IIS, IIS Express, or Cassini? Are you absolutely certain that the site/build you're running in the debugger is not in release mode? You may be debugging a specific build that isn't being modified through the build pipeline (failed builds definitely fall under this category).

我使用VS 2010和MVC 4,默认情况下在调试模式下,我看绝对没有捆绑。我没有明确设置任何东西。如果你看到不同的东西显然必须考虑到它,因为这是不正常的行为。

I'm using VS 2010 and MVC 4 and by default in debug mode, I see absolutely no bundling. I don't have to explicitly set anything. If you're seeing differently, something obviously has to account for it as this isn't normal behavior.

我有一种感觉,你最好的办法是最难的:放松你的提交。让你的工作目录的副本,并恢复到之前的某个时候发生的。验证此版本问题的不会发生的,不只是假设。现在检出提交的时间,现在这点之间一半。再次测试。如果构建尚好,切成两半,然后重复的时间。一旦你打的问题,你知道犯人们介绍了之间的最后一个好的地方提交和一个你目前正在测试。这种技术大大简化了分离的问题,以特定的提交。我几乎从来不去一次提交一次,除非我完全不确定code,或者我已经拥有它可能是一个很好的迹象。

I have a feeling your best approach is the hardest: unwind your commits. Make a copy of your working directory and revert to sometime before this happened. Verify the problem does not occur in this build, don't just assume. Now checkout a commit half way between that point in time and now. Test again. If the build is still good, cut the time in half and repeat. Once you've hit the issue, you know the commit it was introduced in is somewhere between your last "good" commit and the one you're currently testing. This technique greatly simplifies isolating a problem to a specific commit. I almost never go one commit at a time unless I'm completely unsure of the code or I already have a good indication of where it might be.

这篇关于ASP.NET MVC 4捆绑在调试模式下JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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