Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T4 Assembly Directive with Relative Path in Website Project?

I have a website project in Visual Studio and I'm trying to reference some assemblies from the bin directory of the site.

So far, the rooted path is the only one that works:

<#@ Assembly Name="C:\Code\Web Solution\Website\bin\My.dll" />

Other people mentioned using msbuild variables, but this doesn't work for me:

<#@ Assembly Name="$(SolutionDir)Website\bin\My.dll" />

and I'm pretty sure relative paths just flat out don't work (My tt file is in a subfolder in App_Code):

<#@ Assembly Name="..\..\bin\My.dll" />

Without using the rooted path, is there any way to make this work in the context of a website project?

like image 861
John B Avatar asked Jul 25 '13 14:07

John B


1 Answers

GAC or absolute paths are required for assembly references in T4 Templates.

However you can use relative paths from a known path:

eg:

$(SolutionDir)\..\..\packages\Pluralizer.0.3.0.1\lib\net40\Pluralize.dll
like image 157
Mark Redman Avatar answered Oct 23 '22 07:10

Mark Redman