title: Deps File Missing for Dotnet 6 Integration Tests
body: <p>Before I start, I've tried all suggestions from the following and none work:</p>
  <p><a href="https://stackoverflow.com/questions/55131379/integration-testing-asp-net-core-with-net-framework-cant-find-deps-json">Integration testing ASP.NET Core with .NET Framework - can&#39;t find deps.json</a></p>
  <p><a href="https://zimmergren.net/unable-to-find-deps-json-dotnet-azure-devops/" rel="noreferrer">https://zimmergren.net/unable-to-find-deps-json-dotnet-azure-devops/</a></p>
  <hr />
  <p>So I'm trying to write some integration tests for dotnet 6. However, my <code>WebApplicationFactory</code> throws the following error:</p>
  <blockquote>
  <p>System.InvalidOperationException: Can't find
  '/repos/subscription-info-api/tests/SubscriptionInfoApi.Tests.Integration/bin/Debug/net6.0/...</p>
  <p>System.InvalidOperationException Can't find
  '/repos/subscription-info-api/tests/SubscriptionInfoApi.Tests.Integration/bin/Debug/net6.0/testhost.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 testhost.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.    at
  Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<code>1.EnsureDepsFile() at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory</code>1.EnsureServer()
  at
  Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<code>1.CreateDefaultClient(DelegatingHandler[] handlers)    at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory</code>1.CreateDefaultClient(Uri
  baseAddress, DelegatingHandler[] handlers)    at
  Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<code>1.CreateClient(WebApplicationFactoryClientOptions options)    at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory</code>1.CreateClient()
  at SubscriptionInfoApi.Tests.Integration.UnitTest1.Test1() in
  /repos/subscription-info-api/tests/SubscriptionInfoApi.Tests.Integration/UnitTest1.cs:line
  14    at SubscriptionInfoApi.Tests.Integration.UnitTest1.Test1() in
  /repos/subscription-info-api/tests/SubscriptionInfoApi.Tests.Integration/UnitTest1.cs:line
  16    at
  Xunit.Sdk.TestInvoker<code>1.&lt;&gt;c__DisplayClass48_0.&lt;&lt;InvokeTestMethodAsync&gt;b__1&gt;d.MoveNext() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestInvoker.cs:line 264 --- End of stack trace from previous location ---    at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func</code>1 asyncAction) in
  /<em>/src/xunit.execution/Sdk/Frameworks/ExecutionTimer.cs:line 48    at
  Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in
  /</em>/src/xunit.core/Sdk/ExceptionAggregator.cs:line 90</p>
  </blockquote>
  <p>My actual test code is extremely simple:</p>
  <pre><code>   [Fact]
      public async Task Test1()
      {
          await using var app    = new WebApplicationFactory&lt;Program&gt;();
          using var client = app.CreateClient();
          var       res    = await (await client.GetAsync(&quot;/alive-test&quot;)).Content.ReadAsStringAsync();
          Assert.Equal(&quot;Alive!&quot;, res);
      }
  </code></pre>
  <hr />
  <p>As per the suggestions, I've made sure I'm directly referencing <code>Microsoft.AspNetCore.Mvc.Testing -&gt; 6.0.0</code> in my integration tests project. I've also tried the various tweaks to the <code>.csproj</code> files that were suggested but nothing seems to be working.</p>
  <p>I'm stuck for things to try to debug this further, any ideas?</p>