VS2017 .NetCore 2.0 API - Could not load file or assembly Microsoft.AspNetCore.Hosting.Abstractions

10,841

Solution 1

I had the same error attempting to debug a simple Azure Function App (this is using .NET core) created from the Function App template in Visual Studio 2017. Attempting to run in debugger gave me the same error. It turned out to be I had updated the Microsoft.NET.Sdk.Functions package from version 1.0.6 to 1.0.12. That was my problem. Reverted the update back to 1.0.6 and it worked fine. Hope this helps!

Solution 2

Please re-install the nuget package or upgrade to the latest at: https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Abstractions/

Share:
10,841
Dries
Author by

Dries

Updated on June 28, 2022

Comments

  • Dries
    Dries almost 2 years

    I've just created a new API using ASP.NET Core 2.0. I haven't coded anything yet. I just want to test the initial API template.

    When I try to start my project I receive the following error:

    An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

    I do not receive any errors when building the project. The assemby can be found at the following directory: 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.hosting.abstractions\2.0.2'.

    Is that correct? Where should the 'Microsoft.AspNetCore.Hosting.Abstractions' assembly be located and why can't VS find it?

  • baduker
    baduker about 6 years
    Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.
  • Dries
    Dries about 6 years
    Omg, I spent several hours looking for a solution. This actually worked! Thank you!
  • Dries
    Dries about 6 years
    Your suggestion was the first thing I've tried but it did not resolve the problem unfortunately.
  • Benjineer
    Benjineer almost 5 years
    @baduker the link works fine for me. Also, the answer describes what the link is - "the nuget package".