T4 Include file path from project root

我是研究僧i 提交于 2020-02-20 07:18:05

问题


How can I include file relatively to project root? Somthing like <# @include file="~/Infrastructure/Manager.ttinclude" #>


回答1:


You should use $(ProjectDir)

<#@ include file="$(ProjectDir)\Infrastructure\Manager.ttinclude" #>

You can also use $(SolutionDir) for the Solution root.




回答2:


if you want to include file in some shared project then you can use below

<#@ include file="..\AnotherProjectFolderName\AnotherSubFolder\Shared.ttinclude" #>

First .. will be resolved to current file path So if .tt is under any sub folder of project directory then you can use

<#@ include file="..\..\AnotherProjectDirectory\AnotherSubFolder\Shared.ttinclude" #>

One ..\ means one folder level up.



来源:https://stackoverflow.com/questions/11757730/t4-include-file-path-from-project-root

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