Вопрос

I have a problem, i just need to pass a value from template file to another (T4), for example i need to pass controllername from Controller.cs.t4 to list.cs.t4 (MVC 5.1), or if there is away to get controller name into list.cs.t4

Thanks

Это было полезно?

Решение

Share a static class Helper ? , rethink your design to be more "stateless" ?

To share "running-code" please check this answer "Can I execute code from another file in a T4 .tt template for code generation?"

If you want to share code with your regular C# project, that is possible, but you need to build the shared code into an assembly you can reference. It's not possible to just use the <#@ include #> directive to pull in a .cs file directly as the directives don't nest inside control or class feature blocks. 'Quoted From the above Answer'

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top