Use Rooted Paths in T4 Templates for .dlls also in the GAC

rootsI just spent about 2 hours troubleshooting why my T4 Generator wasn’t using the correct version of the DLL. It turns out the latest version of Visual Studio insalled a newer version of ‘Microsoft.SqlServer.Smo’.

My template was originally using the following code:

<#@ assembly name="Microsoft.SqlServer.Smo" #>

I then tried using the full path to ensure it was not pulling from the Global Assembly Cache this seems to have resolved the issue. I now can say with confidence the T4 template will now be shielded from any changes to the GAC made by Visual Studio or SSMS.

<#@ assembly name="$(SolutionDir)CodeGeneration\bin\Debug\Microsoft.SqlServer.Smo.dll" #>

Hopefully, somebody will find this post and save some time. Did I mention I hate the GAC?

Choosing a .NET installer


You know you want it

These days most of us are avoiding deployment hassles by writing web apps and/or mobile apps. However, there are still those wacky edge cases where you need to distribute a good old-fashioned Windows application. I currently have requirements for a project that may not always have internet access ~GASP~ and thus needs to store data locally, throwing a wrench into my make-everything-a-website manifesto.

Continue reading