C# T4 Template equivalent for “extern alias”

陌路散爱 提交于 2020-01-13 14:16:28

问题


I'm looking for a way to make use of an assembly referenced by the project with an alias (i.e. other than global) from a runtime T4 template.

My goal is to be able to reference a namespace, with all its content obviously, from that assembly:

<#@ import namespace="CustomAlias::Target.Namespace" #>

Basically, I'm looking for the equivalent of writing something like:

extern alias CustomAlias;
using CustomAlias::Target.Namespace;

I've attempted searching, here and Google, and the only mention that I've found for aliases in a T4 context was about giving an alias to a namespace. Which is not my current issue.

Is this possible to do, or should I start looking for an alternative solution?

来源:https://stackoverflow.com/questions/22961843/c-sharp-t4-template-equivalent-for-extern-alias

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!