title: T4 Template Could not load file or assembly 'System.Runtime, Version = 4.2.0.0'
body: <p>So I have a T4 Template I'm trying to run at design-time, but it keeps giving me the following error.</p>
  
  <pre><code>Running transformation: System.IO.FileNotFoundException: Could not load 
  file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, 
  PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system 
  cannot find the file specified.
  File name: 'System.Runtime, Version=4.2.0.0, Culture=neutral, 
  PublicKeyToken=b03f5f7f11d50a3a'
  </code></pre>
  
  <p>My Visual Studios solution has 10 projects contained within it, all of which target .Net Core 2.0 framework. My T4 template presently looks as such:</p>
  
  <pre><code>&lt;#@ template debug="false" hostspecific="false" language="C#" #&gt;
  &lt;#@ assembly name="System.Core" #&gt;
  &lt;#@ import namespace="System.Linq" #&gt;
  &lt;#@ import namespace="System.Text" #&gt;
  &lt;#@ import namespace="System.Reflection" #&gt;
  &lt;#@ import namespace="Services.Resources.DataTransferObjects.Infrastructures" #&gt;
  &lt;#@ import namespace="System.Collections.Generic" #&gt; 
  &lt;#@ assembly name="$(TargetDir)Services.dll" #&gt;
  
  
  &lt;#@ output extension=".cs" #&gt;
  public class AdminDTO
  {
          &lt;#var editableObjs = Assembly
              .GetAssembly(typeof(GenericEditable&lt;&gt;))
              .GetTypes()
              .Where(p =&gt; p.BaseType != null &amp;&amp; p.BaseType.IsGenericType &amp;&amp; p.BaseType.GetGenericTypeDefinition() == (typeof(GenericEditable&lt;&gt;)))
              .ToList();
          #&gt;
  }
  </code></pre>
  
  <p>At the moment I only need the assembly I've referenced in the template, which is a .Net Core 2.0 class library project. I've tried adding the System.Runtime.dll reference in this particular library, but it doesn't appear to make any difference.</p>
  
  <p>I've read several other issues similar to this, and it generally seems that .Net Core seems to have issues with T4 Templates, but it appeared most peoples' solutions were to target a .Net Standard library. I'm not sure this is applicable for me, as my entire solution only involves .Net Core projects.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I changed all my projects to target .Net Standard 2.0 instead of .Net Core, and that fixed my initial problem, but now I see this error:</p>
  
  <pre><code>System.Reflection.ReflectionTypeLoadException: Unable to load one or 
  more of the requested types. Retrieve the LoaderExceptions property for 
  more information.
  at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
  at System.Reflection.RuntimeModule.GetTypes()
  at System.Reflection.Assembly.GetTypes()
  </code></pre>