title: Cannot transform T4 templates on VS2017
body: <p>I've been able to transform T4 templates, both on VS2015 and VS2017, until I replaced my failing computer and installed <strong><em>only</em></strong> VS2017 on the new device.</p>
  
  <p>I always get the error:</p>
  
  <blockquote>
    <p>Severity  Code    Description Project File    Line    Suppression State
    Error       An exception was thrown while trying to compile the transformation code. The following Exception was thrown:
    System.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\system32\Microsoft.VisualStudio.Shell'.
    File name: 'C:\WINDOWS\system32\Microsoft.VisualStudio.Shell'
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
       at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
       at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
       at Microsoft.VisualStudio.TextTemplating.CompilerBridge.&lt;>c.&lt;.ctor>b__15_0(String x)
       at System.Linq.Enumerable.WhereSelectListIterator<code>2.MoveNext()
       at System.Linq.Enumerable.&lt;UnionIterator&gt;d__67</code>1.MoveNext()
       at System.Linq.Enumerable.d__67<code>1.MoveNext()
       at System.Linq.Buffer</code>1..ctor(IEnumerable<code>1 source)
       at System.Linq.Enumerable.ToArray[TSource](IEnumerable</code>1 source)
       at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable<code>1 items)
       at Microsoft.CodeAnalysis.ImmutableArrayExtensions.AsImmutableOrEmpty[T](IEnumerable</code>1 items)
       at Microsoft.CodeAnalysis.Compilation.ValidateReferences[T](IEnumerable<code>1 references)
       at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.WithReferences(IEnumerable</code>1 references)
       at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonWithReferences(IEnumerable<code>1 newReferences)
       at Microsoft.VisualStudio.TextTemplating.CompilerBridge.PrepareNewCompilation()
       at Microsoft.VisualStudio.TextTemplating.CompilerBridge.Compile()
       at Microsoft.VisualStudio.TextTemplating.TransformationRunner.Compile(String source, String inputFile, IEnumerable</code>1 references, Boolean debug, SupportedLanguage language, String compilerOptions)          1   </p>
  </blockquote>
  
  <p>I've the "Text Template Transformation" enabled in Visual Studio installer.</p>
  
  <p>I tried copying the DLL  from <code>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies</code> to <code>system32</code> with no luck.</p>
  
  <p>I also tried registering the DLL with <code>gacutil -i</code> with no luck.</p>
  
  <p>Any ideas?</p>