...或者我是如何学会停止担心的,只是针对来自Microsoft的完全未记录的API编写代码.是否有官方System.Web.Optimization发布的实际文档?'cuz我肯定找不到任何,没有XML文档,所有的博客文章都引用了与实际上不同的RC API.安美居..
我正在编写一些代码来自动解析javascript依赖项,并从这些依赖项中动态创建bundle.一切都很好,除非您编辑脚本或以其他方式进行更改,这些更改会影响捆绑而不重新启动应用程序,否则不会反映更改.所以我添加了一个禁用缓存依赖项的选项,以便在开发中使用.
但是,即使捆绑集合已更改,显然也会BundleTables缓存URL .例如,在我自己的代码中,当我想重新创建一个包时,我做了类似这样的事情:
// remove an existing bundle
BundleTable.Bundles.Remove(BundleTable.Bundles.GetBundleFor(bundleAlias));
// recreate it.
var bundle = new ScriptBundle(bundleAlias);
// dependencies is a collection of objects representing scripts,
// this creates a new bundle from that list.
foreach (var item in dependencies)
{
bundle.Include(item.Path);
}
// add the new bundle to the collection
BundleTable.Bundles.Add(bundle);
// bundleAlias is the same alias used previously to create the bundle,
// like "~/mybundle1"
var bundleUrl …Run Code Online (Sandbox Code Playgroud) c# asp.net asp.net-mvc-4 bundling-and-minification asp.net-optimization