title: C# Unity Error: Could not load file or assembly
body: <p>I found this demo article on Unity. Looks pretty straightforward but I'm getting the following error:</p>
  
  <blockquote>
    <p>Could not load file or assembly
    'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
    dependencies. The located assembly's manifest definition does not
    match the assembly reference. (Exception from HRESULT: 0x80131040)</p>
  </blockquote>
  
  <p><a href="https://www.tutorialsteacher.com/ioc/register-and-resolve-in-unity-container" rel="noreferrer">https://www.tutorialsteacher.com/ioc/register-and-resolve-in-unity-container</a></p>
  
  <pre><code>using System;
  using Unity;
  
  namespace UnityContainerDemo
  {
      class Program
      {
          static void Main(string[] args)
          {
              var container = new UnityContainer();
              container.RegisterType&lt;ICar, BMW&gt;();// Map ICar with BMW 
  
              //Resolves dependencies and returns Driver object 
              Driver drv = container.Resolve&lt;Driver&gt;();
              drv.RunCar();
          }
      }
  
      public interface ICar
      {
          int Run();
      }
  
      public class BMW : ICar
      {
          private int _miles = 0;
  
          public int Run()
          {
              return ++_miles;
          }
      }
  
      public class Ford : ICar
      {
          private int _miles = 0;
  
          public int Run()
          {
              return ++_miles;
          }
      }
  
      public class Audi : ICar
      {
          private int _miles = 0;
  
          public int Run()
          {
              return ++_miles;
          }
  
      }
      public class Driver
      {
          private ICar _car = null;
  
          public Driver(ICar car)
          {
              _car = car;
          }
  
          public void RunCar()
          {
              Console.WriteLine("Running {0} - {1} mile ", _car.GetType().Name, _car.Run());
          }
      }
  }
  </code></pre>