RdJNL / TextTemplatingCore

T4 Text Templating with .NET 6
Other
57 stars 15 forks source link

This tool is excellent (also a difference with T4) #6

Closed gary-lg closed 2 years ago

gary-lg commented 3 years ago

Just wanted to leave a note of appreciation - I came across this project from .Net Core issue 2000 and it has put an end to messy devenv.config binding redirects.

The only thing I noticed which was quick to fix is that using the <@ assembly directive takes a path relative to the TT file. With vanilla T4 the path is relative to the solution. For example if we had the folder structure:

MyApp/myApp.sln
MyApp/src/Tests/MyTestProject/myGenerated.tt
MyApp/src/SomeLibrary/bin/debug/net5.0/SomeLibrary.dll

and are writing the template in the context of myGenerated.tt, in vanilla T4 we would use:

<#@ assembly name="src/SomeLibrary/bin/debug/net5.0/SomeLibrary.dll" #>

in TextTemplatingCore we use:

<#@ assembly name="../../SomeLibrary/bin/debug/net5.0/SomeLibrary.dll" #>

Might be worth calling that out in the docs (or not, I'm not your boss)

Thanks again for a great tool

RdJNL commented 3 years ago

Thanks for the compliments and the feedback. When I have some time I'll try to fix this difference. If I can, I want to keep the behavior of this tool similar to the original one.

RdJNL commented 2 years ago

I've looked at this again and have decided to keep the current behavior (paths relative to T4 file). However, you can use $(SolutionDir) at the start of the path to provide a path relative to the solution directory.