Skip to content

System.BadImageFormatException: Could not load file or assembly 'xx\.vscode\extensions\ms-dotnettools.csharp-2.90.51\.roslyn\Microsoft.CodeAnalysis.LanguageServer.dll'. An attempt was made to load a program with an incorrect format. #8598

@zjc615

Description

@zjc615

Issue Description

I got this error when clicking 'Create Project.

Output

2025-09-09 17:35:22.967 [info] Locating .NET runtime version 9.0.1
2025-09-09 17:35:23.177 [info] Dotnet path: C:\Program Files\dotnet\dotnet.exe
2025-09-09 17:35:23.178 [info] Activating C# + C# Dev Kit...
2025-09-09 17:35:23.265 [error] [stderr] Unhandled exception. 
2025-09-09 17:35:23.275 [error] [stderr] System.BadImageFormatException: Could not load file or assembly 'c:\Users\adm.ZJCDEV\.vscode\extensions\ms-dotnettools.csharp-2.90.51\.roslyn\Microsoft.CodeAnalysis.LanguageServer.dll'. An attempt was made to load a program with an incorrect format.
File name: 'c:\Users\adm.ZJCDEV\.vscode\extensions\ms-dotnettools.csharp-2.90.51\.roslyn\Microsoft.CodeAnalysis.LanguageServer.dll'

// ingrone follow
2025-09-09 17:35:23.293 [info] Language server process exited with 3762504530
2025-09-09 17:35:23.294 [error] Microsoft.CodeAnalysis.LanguageServer client: couldn't create connection to server.
Error: Language server process exited unexpectedly
	at ChildProcess.<anonymous> (c:\Users\adm.ZJCDEV\.vscode\extensions\ms-dotnettools.csharp-2.90.51\dist\extension.js:115543:41)
	at ChildProcess.emit (node:events:530:35)
	at ChildProcess._handle.onexit (node:internal/child_process:293:12)

Environment information

VSCode version: 1.103.0 (user setup)
C# Extension: 2.90.51
C# Dev:1.50.33

dotnet --info

.NET SDK:
 Version:           9.0.102
 Commit:            cb83cd4923
 Workload version:  9.0.100-manifests.43af17c7
 MSBuild version:   17.12.18+ed8c6aec5

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

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

Host:
  Version:      9.0.1
  Architecture: x64
  Commit:       c8acea2262

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

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

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

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

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions