Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0

710 Views Asked by At

I am migrating my .NET standard 2.0 class library application to .NET core 3.0 where I want to start web API server from class library, Where class library application is getting launched with executable.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
    <AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
  
  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.0" />
    <PackageReference Include="RestSharp" Version="106.6.10" />
  </ItemGroup>
</Project>

When class library application is getting launched with executable It throws error like below.

Creating of instance of type 'MySampleDll' failed: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

When I download Microsoft.Extensions.Configuration.Abstractions from nuget package and manually keep the library in output directory. It throws new error saying Microsoft.AspNetCore 3.0.0 could not be found. Please help me what I am doing wrong.

List of SDKS installed

1

There are 1 best solutions below

0
eduherminio On

Get rid of Microsoft.AspNetCore.App, it's not needed any more, as explained in Microsoft documentation.

Also, consider upgrading to .NET Core 3.1 instead, which is an LTS version. .NET Core 3.0 has already reached end of life and is no longer supported.