Transformation T4 during assembly with reference to the project assembly in the same solution

I managed to get my T4 file working correctly when I run it in visual studio, but it fails when it automates it during the build process automatically.

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

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

To just run a single T4 template during assembly, I created a post assembly 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 an IDE, it throws an error because it processes $ (SolutionDir) literally, therefore it cannot find the assembly link for My.Core.dll.

So my question is: how can I refer to this assembly in the T4 template so that it works with the assembly process that I have, and ideally you can still right-click and start the conversion manually, but this is not so important.

I should also note that using the full path is not an option, as there are several developers, and the source code will live in potentially different directories on each developer's machine.

+4
source share

All Articles