title: Can't read types from assembly using Entity Framework Core 5.0
body: <p>I am trying to read the types out of an assembly that contains Entity Framework Core, but I am getting this error:</p>
  <blockquote>
  <p>Could not load file or assembly '..file path..\TestRoslyn\Database\bin\Debug\net5.0\Database.dll'. The system cannot find the file specified.</p>
  </blockquote>
  <p>The code I am using to read the types is pretty simple:</p>
  <pre><code>using System;
  using System.Reflection;
  using System.Threading.Tasks;
  using Microsoft.Build.Locator;
  using Microsoft.CodeAnalysis.MSBuild;
  
  namespace TestRoslyn
  {
      class Program
      {
          static async Task Main(string[] args)
          {
              if (!MSBuildLocator.IsRegistered) 
                   MSBuildLocator.RegisterDefaults();
  
              using var w = MSBuildWorkspace.Create();
  
              // Substitute your file location
              var basePath = @&quot;C:\Users\username\source\repos\&quot;;
              var slnFile = @$&quot;{basePath}TestRoslyn\TestRoslyn.sln&quot;;
              var sln = await w.OpenSolutionAsync(slnFile);
  
              foreach (var p in sln.Projects)
              {
                  var asm = Assembly.LoadFrom(p.OutputFilePath);
                  foreach(var t in asm.GetTypes())
                      Console.WriteLine($&quot;{p.OutputFilePath}\t{t.FullName}&quot;);
              }
          }
      }
  }
  </code></pre>
  <p>This works as is. However, when I add a simple project to the solution that references nuget package <code>Microsoft.EntityFrameworkCore</code> (5.0) with one file:</p>
  <pre><code>using Microsoft.EntityFrameworkCore;
  
  namespace Database
  {
      public class AppContext: DbContext
      {
      }
  }
  </code></pre>
  <p>(To keep it simple, I didn't include anything in the <code>AppContext</code> class except the base class.)</p>
  <p>When I add a project with the <code>EntityFrameworkCore</code> nuget package to the solution above with just this class I get the error indicated above.</p>
  <p>Not sure what the cause is? Do I need to somehow load the nuget package into the workspace? If so, how?</p>