My webb app works fine when run from Visual Studio, but when I publish and try to load a page, I get:
InvalidOperationException: Cannot find compilation library location for package 'Microsoft.AspNet.WebApi.Client' Microsoft.Extensions.DependencyModel.CompilationLibrary.ResolveReferencePaths(ICompilationAssemblyResolver resolver, List assemblies)
I've been stuck on this for quite a while. I've attempted to apply the various workarounds in the thread https://github.com/dotnet/core-setup/issues/2981, but none of them have worked.
My csproj file is pasted below. I'm not sure what other information would be useful:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>aspnet-CrowdQuery2-8C668DB3-5C80-4D9E-851D-2434D0CDA7E9</UserSecretsId>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.2</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.6" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.3" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\" />
</ItemGroup>
</Project>
I've been having the same issue using Microsoft Azure.
The solution in this case was to clean up the wwwroot
folder in our web app using Kudu (Development Tools -> Advanced Options), because there were some old DLLs still left from before the upgrade to .NET Core 2.1, because .NET Core 1 publishes the DLLs to the wwwroot
folder, whereas in 2.1, the DLLs are loaded from a global store.
After having completely emptied the wwwroot
folder, and redeploying the app, the error was resolved and the app ran as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With