T4 transform on build with reference to project assembly in same solution
Asked Answered
C

0

6

I was able to get my T4 file to work properly when I run it within visual studio but it errors out when automating it to happen during the build process automatically.

The problem is that in order to reference an assembly that is in the same solution but another project I added this line:

<#@ assembly name="$(SolutionDir)\My.Core\bin\Debug\My.Core.dll" #>

In order to just run a single T4 template on build, I created a post build-event with the following command:

"%PROGRAMFILES(x86)%\Common Files\microsoft shared\TextTemplating\10.0\TextTransform.exe" $(ProjectDir)\Features\Admin\app\Abilities.tt

But since the host is not the IDE environment at this point it throws an error because it is treating the $(SolutionDir) a literally so it can't find the assembly reference for My.Core.dll.

So my question is, how can I reference that assembly within the T4 template so that it works with the build process I have and ideally still be able to right click and run the transformation manually, but that isn't as important.

I should also note that using the full path is not an option since there are multiple developers and the source code will be living in potentially different directories on each developer machine.

Conventioneer answered 10/12, 2013 at 22:14 Comment(1)
#13806063Ciro

© 2022 - 2024 — McMap. All rights reserved.