开发者

How do I generate links in nested folders in T4 for ASP.NET MVC?

开发者 https://www.devze.com 2023-03-10 09:30 出处:网络
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 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?


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 the StaticFilesFolders list instead of "Areas/Webcard/Scripts". This should allow you to then access the scripts like @Links.Areas.Webcard.Scripts.Script1_js.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号