Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T4 Include file path from project root

Tags:

.net

t4

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

like image 662
SiberianGuy Avatar asked Aug 01 '12 10:08

SiberianGuy


2 Answers

You should use $(ProjectDir)

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

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

like image 125
podiluska Avatar answered Dec 15 '22 16:12

podiluska


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.

like image 30
Rajnikant Avatar answered Dec 15 '22 18:12

Rajnikant