dotnetcore / SmartCode

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请问怎么编写自定义模板?

beginor opened this issue · comments

这个项目不错, 有点儿像当年的 CodeSmith , 请问怎么编写自定义 cshtml 模板?比如我要生成 NHibernate 或者 EF 的文件, 该怎么操作?

@beginor v1.5.0版本之后Razor模板引擎使用的是官方版本,所以这个应该没有什么学习成本,需要注意的是所有的模板引擎的model 均为 BuidContext,你可以参考源代码中的模板试着写一下扩展,然后放到RazorTemplates目录,构建任务时指定好该模板即可。

:octocat: From gitme Android

是放在全局目录还是本地目录?

如果是nuget tool 安装的话放在以下目录里边有个 RazorTemplates 目录

Linux/macOS : $HOME/.dotnet/tools/.store/smartcode.cli
Windows : %USERPROFILE%\.dotnet\tools\.store\smartcode.cli