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

.NET Framework 4.5.2 MVC项目netstandard程序集引用错误求助

Fix for netstandard 2.0 Reference Error in .NET Framework 4.5.2 MVC App (VS2017 15.9.12)

Hey there, sorry you're stuck with this netstandard reference issue—let's break down the fixes that should get your MVC app running again in VS2017 15.9.12. Since your teammate on 15.8.1 has no problems, this is likely a compatibility quirk introduced in the newer VS update. Here are the steps to try:

1. Manually Add the netstandard Assembly Reference

Sometimes VS doesn't auto-include the required reference, so let's add it manually:

  • Right-click your MVC project in Solution Explorer → Add → Reference
  • In the Reference Manager window, switch to the Browse tab
  • Navigate to the netstandard.dll location (typically found at C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0\netstandard.dll—adjust the path if your .NET Core SDK is installed elsewhere)
  • Select the DLL and click Add, then confirm the reference is listed under your project's References folder

2. Update Assembly Binding Redirects in web.config

Oftentimes, version mismatches cause this error, so adding a binding redirect can resolve it:

  • Open your project's web.config file
  • Locate the <runtime> section (add it if it doesn't exist)
  • Insert this binding redirect for netstandard:
<dependentAssembly>
    <assemblyIdentity name="netstandard" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
  • Also, ensure your project's .csproj file has this setting in the <PropertyGroup> to auto-generate necessary redirects:
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

3. Verify NuGet Package Compatibility

A newer NuGet package version might be pulling in netstandard 2.0 dependencies that VS 15.9.x is enforcing stricter:

  • Open the NuGet Package Manager for your project
  • Install or update the NETStandard.Library package to version 2.0.3 (this is the latest compatible version for .NET Framework 4.5.2)
  • Compare your NuGet package versions with your teammate's—if they're using older versions of certain packages, try rolling back to those versions to match their setup

4. Repair or Roll Back Your VS2017 Installation

Since the issue doesn't occur in VS 15.8.1, the 15.9.12 update might have introduced a bug or changed dependency handling:

  • Open the Visual Studio Installer, select your 2017 installation, and click Modify → Repair to fix any corrupted files
  • If repairing doesn't work, you can download the VS2017 15.8.1 installer from Microsoft's archive and roll back to that version to match your teammate's environment

5. Compare Project Files with Your Teammate

Small differences in the .csproj file could be the culprit:

  • Ask your teammate to share their .csproj file, then compare it with yours
  • Look for missing references, different target framework settings, or NuGet package references that might be triggering the netstandard requirement

Give these steps a try in order—most folks fix this with either the binding redirect or NuGet package adjustments. Let me know if any of these work for you!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.13 07:51:21