title: Missing Assemblies in T4 becomes GAC Hell?
body: <p>I was trying to follow Oleg Sych's tutorials on T4 <a href="http://www.olegsych.com/2008/09/t4-tutorial-creatating-your-first-code-generator/" rel="nofollow">http://www.olegsych.com/2008/09/t4-tutorial-creatating-your-first-code-generator/</a>, kinduva "Hello, Northwind!" but right away in the second step (at bottom) I got ten "missing assembly" errors like this</p>
  
  <blockquote>
    <p>Error  1   Compiling transformation: The type >'Microsoft.SqlServer.Management.Sdk.Sfc.ISfcValidate' is defined in an assembly that is >not referenced. You must add a reference to assembly >'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, >PublicKeyToken=89845dcd8080cc91'.</p>
  </blockquote>
  
  <p>I made sure all the sql server assemblies from (list below) are in %windir%\assembly (I think that’s the GAC), but no good. I added the assemblies to the visual-studio project; no good. I guess the only thing I can do is add absolute paths to the assemblies, but that is a HORRIBLE solution since I can’t share the solution with programmers who don’t have exactly the same absolute paths. Any ideas how to fix this, please &amp; thanks?</p>
  
  <pre><code>&lt;#@ template language="C#" #&gt;
  &lt;#@ output extension="SQL" #&gt;
  &lt;#@ assembly name="Microsoft.SqlServer.ConnectionInfo" #&gt;
  &lt;#@ assembly name="Microsoft.SqlServer.Smo" #&gt;
  &lt;#@ import namespace="Microsoft.SqlServer.Management.Smo" #&gt;
  &lt;#
      Server server = new Server();
      Database database = new Database(server, "Northwind");
      Table table = new Table(database, "Products");
      table.Refresh();
  #&gt;
  create procedure Products_Delete
      @ProductID int
  as
      delete from Products
      where ProductID = @ProductID
  </code></pre>
  
  <p>Here's stuff I put in the GAC</p>
  
  <pre><code>"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.WmiEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.ReportingServices.Interfaces.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfoExtended.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Dmf.Adapters.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Dmf.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.DmfSqlClrWrapper.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Collector.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.CollectorEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Utility.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.UtilityEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.PolicyEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.RegSvrEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ServiceBrokerEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SmoExtended.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SqlWmiManagement.dll"
  "C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SString.dll"
  </code></pre>