Our company has legacy system that heavily relies on T4 and the employee who architected it is gone. It was running fine for us, however recently some developers upgraded to VS2015. The T4 transformations stopped working for them (with error similar as reported below). It looked at though there were references to `Microsoft.VisualStudio.TextTemplating.12.0.dll`. They changed the references to '14' and all worked for them. However, the same project shared by other developers on VS2013 no longer worked with error: 

> 
> Compiling transformation: The type
>  'Microsoft.VisualStudio.TextTemplating.TextTransformation' is defined
>  in an assembly that is not referenced. You must add a reference to
>  assembly 'Microsoft.VisualStudio.TextTemplating.14.0,
>  Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
> 
> 
> 

Are you able to run T4 on same project that is opened in both VS2013 and VS2015? One side note, there was a dependent assembly that the old employee made that all the TextTransformations derived from (it also provides helpers that are used in the \*.tt files). Unfortunately it used an interface only present in `Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll`, so that old reference is being dragged aroundÎ. Not sure if that is contributing or not. But basically here is the bottom line:

When all devs on VS2013, everything worked and references were:

```
Microsoft.VisualStudio.TextTemplating.12.0.dll
Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll
Microsoft.VisualStudio.TextTemplating.VSHost.12.0.dll

```

Then when some went to vs2015, the only way to get it to work was to change out the 12.0\* dlls with 14.0, but then vs2013 developers ceased to work.

**UPDATE**

I might not have clarified our complete setup. We have 20-30 \*.tt files in a separate project that is included in the solution with the project that will have Text Transformations applied to it.

1. We have a helper Extensibility.CodeGeneration.dll (this references Microsoft.VisualStudio.TextTemplating.N.dll files as well) that have several static helpers and also base classes that derive from Microsoft.VisualStudio.TextTemplating.TextTransformation.
2. The 'templates' project that contains all the \*.tt files, *every* *.tt file use static methods from our helper dll. It also references all the same Microsoft.VisualStudio.* dlls.
3. In *every* \*.tt file, we have something that looks like this, where AreaTemplate is a class defined in the \*.tt file itself and either derives from Microsoft.VisualStudio.TextTemplating.TextTransformation or one of the exposed base classes in our helper dll. 

var template = new AreaTemplate { Settings = settings, Area = area, Layouts = layouts };
Write( template.TransformText() );
4. It was asked in comments how I obtained/used a 'host'. In searching through code we have a few common scenarios (all done inside the helper dll). In each instance, host is of type `ITextTemplatingEngineHost`.

Case 1: 

```
var dte = (EnvDTE.DTE)( (IServiceProvider)host ).GetService( typeof( EnvDTE.DTE ) );

```

Case 2: 

```
var hostServiceProvider = (IServiceProvider)host;

```

Given #3 above, I think I *have to* reference the Microsoft.TextTemplating dlls (and not just the Interfaces dll) due to the use/exposing of TextTransformation class.

Also, if I change references to in both my 'Helper' and 'Templates' project to 12.0...in vs2015, I get error about 'you must add reference to 12.0'...I have references to that in both applicable (in my eyes) projects...not sure why VS tells me to add it. I tried adding an explicit reference in the \*.tt file using 

```
<#@ assembly Name="$(ProjectDir)..\..\Assemblies\Microsoft.VisualStudio.TextTemplating.12.0.dll" #>

```

But then I got the error 

> 
> The type 'Microsoft.VisualStudio.TextTemplating.TextTransformation'
>  exists in both
>  'c:\BTR\Source\Assemblies\Microsoft.VisualStudio.TextTemplating.12.0.dll'
>  and
>  'c:\Windows\Microsoft.NET\assembly\GAC\_MSIL\Microsoft.VisualStudio.TextTemplating.14.0\v4.0\_14.0.0.0\_\_b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.14.0.dll'
> 
> 
> 

It is almost like there is a hidden/implicit reference to the latest Texttemplating already built into VS?? 

Not sure if our setup was a more complicated way to achieve our original goal, but I don't think I'll be able to unwind it and change if we are doing it the incorrect way.

Given our setup let me know if you think I am stuck or not. I was trying to figure out 'conditions' in MSBuild to help support both Visual Studios but couldn't succeed.

Thanks in advance.