首页 > 代码库 > T4 assembly
T4 assembly
In a T4 template the executing assembly is not yours but one from the T4 engine.
To access types from your assemblies, you have to perform the following steps:
Add a reference to your assembly to the template. Put that at the top of it:
<#@ assembly name="$(SolutionDir)<Project>\bin\Debug\<Project>.dll" #>
Import the namespace of your assembly. Put that somewhere below the previous line:
<#@ import namespace="<Project>.<Namespace>" #>
To access the types in this assembly, pick one of them and get the assembly from it:
var assembly = typeof(<Type in assembly>).Assembly;var types = assembly.GetTypes() .Where(t => String.Equals( t.Namespace, "RepoLib.Rts.Web.Plugins.Profiler.Models", StringComparison.Ordinal)) .ToArray();
T4 assembly
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。