aspire: Error launching from Visual Studio: Could not load file or assembly Microsoft.Extensions.Configuration.Binder

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

After updating Visual Studio to 17.14.2, I can’t get Aspire projects to launch. I tried repairing the VS install with no effect. I tried an empty Aspire project, no effect.

Expected Behavior

Launch Aspire

Steps To Reproduce

  • Updated VS to 17.14.2
  • Created an empty project (see below)
  • Press run in Visual Studio
<Project Sdk="Microsoft.NET.Sdk">

  <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <IsAspireHost>true</IsAspireHost>
    <UserSecretsId>7e7a7415-446f-401d-bf33-f3d06a044197</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
  </ItemGroup>

</Project>
var builder = DistributedApplication.CreateBuilder(args);

builder.Build().Run();

Exceptions (if any)

Immediately after pressing the run button in visual studio:

---------------------------
Microsoft Visual Studio
---------------------------
Could not load file or assembly 'Microsoft.Extensions.Configuration.Binder, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
---------------------------
OK   
---------------------------

Image

.NET Version info

.NET SDK: Version: 9.0.300 Commit: 15606fe0a8 Workload version: 9.0.300-manifests.af4147de MSBuild version: 17.14.5+edd3bbf37

Runtime Environment: OS Name: Windows OS Version: 10.0.26100 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.300\

.NET workloads installed: There are no installed workloads to display. Configured to use loose manifests when installing new manifests.

Host: Version: 9.0.5 Architecture: x64 Commit: e36e4d1a8f

.NET SDKs installed: 8.0.410 [C:\Program Files\dotnet\sdk] 9.0.300 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Anything else?

Microsoft Visual Studio Professional 2022 Version 17.14.2 VisualStudio.17.Release/17.14.2+36121.58 Microsoft .NET Framework Version 4.8.09032

Installed Version: Professional

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 17.14.114.53116 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.14.114.53116 Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio 2.6.5000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 17.14.114.53116 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.5000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 4.14.0-3.25229.6+871ef6369443071681de3351d30f41ea78ab48e6 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub Copilot 17.14.698.11175 GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

Microsoft Azure Hive Query Language Service 2.6.5000.0 Language service for Hive query

Microsoft Azure Stream Analytics Language Service 2.6.5000.0 Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.14.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.14.3.2526604+8cce8109a5fd0118f26e7622dd596fd2c5b912ab Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.14.26.0 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 17.0.40502.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.14.0-3.25229.6+871ef6369443071681de3351d30f41ea78ab48e6 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.14.0-beta.25230.7+c1a9d78ad4a474a716ccffb4367ed5151e3f7c9f Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 52 (42 by maintainers)

Most upvoted comments

The fix is in VS main branch now.

We can add Microsoft.Extensions.Configuration.Binder.dll to shared assemblies folder

Are you suggesting moving it to Common7\ServiceHub\SharedAssemblies? If so, I’m not sure how that would resolve the issue. Microsoft.Extensions.Logging.Console would still be loaded as version 8, which depends on version 8 of both Microsoft.Extensions.Configuration.Binder.dll and Microsoft.Extensions.Configuration.Abstractions.dll. From what I understand, the assemblies in Common7\ServiceHub\SharedAssemblies are version 9. Or are you also suggesting that Microsoft.Extensions.Logging.Console be moved there as well?

The core issue seems to be that we’re loading mixed versions of Microsoft.Extensions libraries within the same process. I believe the proper solution is to align all these libraries to the same version to avoid conflicts and ensure compatibility.

@LittleLittleCloud I assume you’ll follow up here to get this fixed?

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\ServiceHub\Hosts\ServiceHub.Host.dotnet.x64\ServiceHub.Host.dotnet.x64.runtimeconfig.json:

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "rollForward": "Major",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "8.0.0"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "8.0.0"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "8.0.0"
      }
    ],
    "configProperties": {
      "System.GC.Server": false,
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true,
      "System.Runtime.TieredPGO": false,
      "CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
    }
  }
}

Need to sleep - if you need more info, I’m available in ~10 hours

@ikkentim - do you have a Microsoft.Extensions.Configuration.Binder.dll in C:\Program Files\Microsoft Visual Studio\2022\Professional\dotnet\net8.0\runtime\shared\Microsoft.AspNetCore.App\8.0.17? That’s where Microsoft.Extensions.Logging.Console.dll is getting loaded from. So the Binder.dll should be loaded from there as well.