title: Error on published ASP.NET core site: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client'
body: <p>My webb app works fine when run from Visual Studio, but when I publish and try to load a page, I get:</p>
  
  <blockquote>
    <p>InvalidOperationException: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client'
    Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List assemblies)</p>
  </blockquote>
  
  <p>I've been stuck on this for quite a while. I've attempted to apply the various workarounds in the thread <a href="https://github.com/dotnet/core-setup/issues/2981" rel="nofollow noreferrer">https://github.com/dotnet/core-setup/issues/2981</a>, but none of them have worked.</p>
  
  <p>My csproj file is pasted below. I'm not sure what other information would be useful:</p>
  
  <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
      &lt;UserSecretsId&gt;aspnet-CrowdQuery2-8C668DB3-5C80-4D9E-851D-2434D0CDA7E9&lt;/UserSecretsId&gt;
      &lt;PublishWithAspNetCoreTargetManifest&gt;false&lt;/PublishWithAspNetCoreTargetManifest&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;PropertyGroup&gt;
      &lt;RuntimeFrameworkVersion&gt;2.1.2&lt;/RuntimeFrameworkVersion&gt;    
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.6" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.App" /&gt;
      &lt;PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.3" PrivateAssets="All" /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;Folder Include="ViewModels\" /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>