You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS2017 .NetCore 2.0 API启动报错:无法加载Microsoft.AspNetCore.Hosting.Abstractions

Fixing System.IO.FileNotFoundException for Microsoft.AspNetCore.Hosting.Abstractions v2.0.2.0 in ASP.NET Core 2.0 API

Hey there, let's work through this issue together. That error about missing Microsoft.AspNetCore.Hosting.Abstractions v2.0.2.0 is a classic one with older ASP.NET Core setups, usually stemming from mismatched package versions or stale build files. Here are the steps to resolve it:

Step 1: Clean up build artifacts and rebuild

Stale files in your bin or obj folders can cause version conflicts. Let's wipe them out and start fresh:

  • Manually delete the bin and obj directories from your project root.
  • Run these commands in your project directory:
    dotnet clean
    dotnet build
    

Step 2: Ensure consistent NuGet package versions

All ASP.NET Core-related packages should target the same version (2.0.2 in this case). Open your .csproj file and check:

  • If you're using the meta-package, make sure it's set to 2.0.2:
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.2" />
    
  • If you're referencing individual packages, verify every Microsoft.AspNetCore.* entry has the same Version attribute (e.g., 2.0.2).

Step 3: Verify your .NET Core SDK version

ASP.NET Core 2.0.2 requires a compatible SDK. Check which SDKs you have installed:

dotnet --list-sdks

If you don't see a 2.0.x SDK listed, install the matching .NET Core 2.0 SDK (you can grab this from Microsoft's official site).

Step 4: Clear NuGet cache

Corrupted or outdated cached packages can cause this error. Clear the cache and restore packages again:

dotnet nuget locals all --clear
dotnet restore

Step 5: Check your launch configuration

Double-check your Properties/launchSettings.json file to ensure there's no hardcoded path to an old version of the assembly, or incorrect environment settings that might be loading the wrong files.

Most of the time, steps 1 and 2 will resolve the issue right away. If not, work through the rest—one of these should get your template API up and running!

内容的提问来源于stack exchange,提问作者Dries

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 06:55:43