0

I am using an existing T4 Template that I last used about 6 months ago and I'm not aware of anything having changed. However I am not getting the following exception, when I save the template file:

Errors were generated when initializing the transformation object. The transformation will not be run. The following Exception was thrown: System.IO.FileNotFoundException: Could not load file or assembly 'T4Toolbox, Version=11.0.0.0, Culture=neutral, PublicKeyToken=dc4a538672a7b38f' or one of its dependencies. The system cannot find the file specified. File name: 'T4Toolbox, Version=11.0.0.0, Culture=neutral, PublicKeyToken=dc4a538672a7b38f'

Server stack trace: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) ...

The header for my tt file is:

<#@ template language="C#" debug="True" #>
<#@ output extension="cs" #>
<#@ include file="T4Toolbox.tt" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.IO" #>
<#@ assembly name="System.Xml"#>
<#@ assembly name="System.Linq"#>
<#@ assembly name="$(TargetPath)" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections.ObjectModel" #>
<#@ import namespace="MyNamespace" #>
<#@ parameter name="className" type="System.String" #>

I have checked Tools > Extension and Updates and I have Version 11.8.0.0 installed.

Is there anything else I can check?

openshac
  • 4,966
  • 5
  • 46
  • 77

1 Answers1

0

OK, so I found out what was going on. It seems that T4 Toolbox is sensitive to which account installed the T4 Toolbox Extension through Visual Studio.

In our development environment we use two user accounts for development, one with elevate privileges. It seems the T4 Toolbox Extension was installed using one account and I was trying to use it with the other account.

So just a word of warning for anyone else who encountered this problem, ensure that the Extension was installed with the correct account, as the extension won't work across multiple accounts, even though it is shown as correctly installed.

Or alternatively do as I did and uninstall it. Then install it using the desired account.

openshac
  • 4,966
  • 5
  • 46
  • 77