将文件夹中的所有文件包含在一个包中 [英] Include all files in a folder in a single bundle

查看:34
本文介绍了将文件夹中的所有文件包含在一个包中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 BundleConfig 时是否可以包含文件夹的所有文件,包括子文件夹(及其子文件夹等)的所有文件?

When using BundleConfig is it possible to include all files of a folder including all the files of the childfolders (and their childfolders etc.)?

我找到了 .IncludeDirectory() 但它似乎只包含文件夹本身的文件,而不包含子文件夹的文件.

I found .IncludeDirectory() but it seems to only include the files of the folder itself, not the files of the subfolders.

推荐答案

使用IncludeDirectory 方法接受 bool searchSubdirectories 作为第三个参数.

Use the overload of IncludeDirectory method which accepts bool searchSubdirectories as third parameter.

MSDN:

searchSubdirectories - 指定是否递归搜索directoryVirtualPath 的子目录.

searchSubdirectories - Specifies whether to recursively search subdirectories of directoryVirtualPath.

示例:

bundles.Add(new ScriptBundle("~/bundles/scripts")
    .IncludeDirectory("~/Scripts", "*.js", true));

这篇关于将文件夹中的所有文件包含在一个包中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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