如何在 T4 中的 ASP.NET MVC 嵌套文件夹中生成链接?
我们正在使用 T4MVC 为我们生成脚本和内容的链接。我们已向某些区域添加了 Script
文件夹,并且我们希望 T4MVC 也为它们生成链接。
我们尝试修改它以将其作为一行添加到 T4MVC.tt.settings.t4
,但不幸的是没有成功。尚未生成 Areas/Webcard/Scripts
文件夹的链接:
readonly string[] StaticFilesFolders = new string[] {
"Scripts",
"Content",
"App_Sprites",
"Areas/Webcard/Scripts"
};
当我向每个区域添加文件夹时,如何生成新文件夹的链接?
We are using T4MVC to generate for us links to our scripts and content. We've added a Script
folders to some of our areas, and we want T4MVC to generate links for them as well.
We've tried to modify it to add it as an line to T4MVC.tt.settings.t4
, but unfortunately with no success. The links for the Areas/Webcard/Scripts
folder haven't been generated:
readonly string[] StaticFilesFolders = new string[] {
"Scripts",
"Content",
"App_Sprites",
"Areas/Webcard/Scripts"
};
How do I generate links for a new folder when I add a folder to each area?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来
StaticFilesFolders
不支持/识别路径分隔符。但是,它确实会递归处理项目,因此您可能需要尝试仅将"Areas"
添加到StaticFilesFolders
列表中,而不是"Areas/Webcard/Scripts"
代码>.这应该允许您访问类似@Links.Areas.Webcard.Scripts.Script1_js
的脚本。It doesn't look like
StaticFilesFolders
supports/recognizes the path delimiter. It does however process items recursively, so you may want to try just adding"Areas"
to theStaticFilesFolders
list instead of"Areas/Webcard/Scripts"
. This should allow you to then access the scripts like@Links.Areas.Webcard.Scripts.Script1_js
.