title: xUnit - deps.json not created for Integration Test in .NetCore 3.1 [Api.deps.json'. This file is required for functional tests to run properly.]
body: <p>I have a visual studio solution with 2 projects, both in .Net Core 3.1</p>
  <p>Xyz.Api,
  Xyz.ApiTests</p>
  <p>ApiTests is a xUnit project for integration testing.</p>
  <p>I have followed what has been mentioned here.
  <a href="https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1" rel="nofollow noreferrer">Integration Tests in .NET Core</a></p>
  <p>This is what <code>ApiTests.csproj</code> looks like</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
      &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.NET.Test.Sdk&quot; Version=&quot;16.5.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.Mvc.Testing&quot; Version=&quot;3.1.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.NETCore.App&quot; Version=&quot;2.2.8&quot; /&gt;
      &lt;PackageReference Include=&quot;xunit&quot; Version=&quot;2.4.0&quot; /&gt;
      &lt;PackageReference Include=&quot;xunit.runner.visualstudio&quot; Version=&quot;2.4.0&quot; /&gt;
      &lt;PackageReference Include=&quot;coverlet.collector&quot; Version=&quot;1.2.0&quot; /&gt;
    &lt;/ItemGroup&gt;
      &lt;ItemGroup&gt;
      &lt;ProjectReference Include=&quot;..\Xyz.Api\Xyz.Api.csproj&quot; /&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>I am able to run the tests from Visual Studio and it works fine.</p>
  <p>But when I publish the ApiTests project, it doesn't create Xyz.Api.deps.json file which is required to run test using .net core cli.</p>
  <p>This is the error I get with command &quot;<code>dotnet test Xyz.ApiTests.dll</code>&quot;</p>
  <pre><code>System.InvalidOperationException : Can't find'D:\T\Xyz.Api.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 '&lt;PreserveCompilationContext&gt;true&lt;/PreserveCompilationContext&gt;'. 
  </code></pre>
  <p>I need to do this to make sure it works in Azure Pipeline.</p>
  <p>Is there anything I am missing, or is there any other way to do this?</p>