Looking through the source code from TextTransformation.exe (using ILSpy), I do not think that this is possible without changing the template (but I have a solution).
Ultimately, we take care of this step while parsing the template where Microsoft.VisualStudio.TextTemplating.Engine.ResolveAssemblyReferences () is called. This delegates to ITextTemplatingEngineHost.ResolveAssemblyReference () (although it expands environment variables first)
When the template is launched from the command line, the implementation used is executed using CommandLineHost , and its implementation simply looks for the file specified in the reference paths and in the GAC. Given that the file name at this point will still contain the $ (SolutionPath) bit, it will never succeed.
You can implement your own version of TextTransform.exe, but you will have to start mostly from scratch (or use reflection), because CommandLineHost is internal :-( Or you can potentially use the mono port fooobar.com/questions/31146 / ...
I canβt say that I am pleased with this because I ended up in the same boat ...
Edit: However, since ultimately all you have to do is change the template, I put together a PowerShell script to copy the templates to the temp directory, manually expanding $ (SolutionDir) in the process and executing them from there. Everything seems to be working fine.
Drop this into an offensive project (you might want to change the file extension), and you should be fine:
<
source share