title: Integration testing ASP.NET Core with .NET Framework - can't find deps.json
body: <p>I have a ASP.NET Core Web API project targeting .NET Framework 4.7 that I'm trying to write integration tests for. I created a unit test project using Visual Studio Add new project and then the Unit Test Project (.NET Framework) template. I added the Microsoft.AspNetCore.Mvc.Testing NuGet package to the test project, and I have the following test:</p>
  
  <pre><code>using System.Threading.Tasks;
  using Microsoft.AspNetCore.Mvc.Testing;
  using Microsoft.VisualStudio.TestTools.UnitTesting;
  
  namespace TestRepro.Tests
  {
      [TestClass]
      public class UnitTest1
      {
          [TestMethod]
          public async Task TestMethod1()
          {
              var factory = new WebApplicationFactory&lt;Startup&gt;();
              var client = factory.CreateClient();
              var response = await client.GetAsync("/api/values");
          }
      }
  }
  </code></pre>
  
  <p>But this throws the following exception:</p>
  
  <blockquote>
    <p>Test method TestRepro.Tests.UnitTest1.TestMethod1 threw exception: 
    System.InvalidOperationException: Can't find'[path removed]\TestRepro.Tests\bin\Debug\TestRepro.deps.json'. This file is required for functional tests to run properly. There should be a copy of the file on your source project bin folder. If that is not the case, make sure that the property PreserveCompilationContext is set to true on your project file. E.g 'true'. For functional tests to work they need to either run from the build output folder or the TestRepro.deps.json file from your application's output directory must be copied to the folder where the tests are running on. A common cause for this error is having shadow copying enabled when the tests run.</p>
  </blockquote>
  
  <p>I have verified that TestRepro.deps.json exists in the web application output folder (TestRepro\bin\Debug\net47), but it is not copied to the test project output folder (TestRepro.Tests\bin\Debug). And I have not been able to find out how to disable shadow copying.</p>
  
  <p><strong>Edit:</strong> <a href="https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-2.2#aspnet-core-integration-tests" rel="noreferrer">The documentation</a> says:</p>
  
  <blockquote>
    <p>The Microsoft.AspNetCore.Mvc.Testing package handles the following tasks: Copies the dependencies file (*.deps) from the SUT into the test project's bin folder.</p>
  </blockquote>
  
  <p>But that doesn't seem to work. I can copy the file manually, but that doesn't work in a automated build scenario. One way would be to have a build step doing it in TeamCity, but it feels crude. Any ideas?</p>
  
  <p>I have <a href="https://github.com/henrik-olsson-valtech/TestRepro" rel="noreferrer">a repro on GitHub</a> if that helps.</p>