Buildalyzer: BadImageFormatException: Microsoft.Build.Tasks.CodeAnalysis

I was trying to use Buildalyzer to load .NET Core SDK project, but I was getting this exception:

System.BadImageFormatException: Could not load file or assembly ‘Microsoft.Build.Tasks.CodeAnalysis, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

I thought that probably I was making some mistake, but then I downloaded this repo and tried to run the tests. The .NET Core and .NET Standard SDK project tests fail with the same exception.

Buidalyzer version: 0.1.4 Visual Studio version: 15.4

dotnet --info:

.NET Command Line Tools (2.0.2)

Product Information:
 Version:            2.0.2
 Commit SHA-1 hash:  a04b4bf512

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

The x86 version of the .NET Core SDK probably ships a x86 version of Microsoft.Build.Tasks.CodeAnalysis.dll, I think that it wouldn’t work if it was x64.

@jp2masa I moved your second issue regarding resource loading problems to #11 - please continue the discussion on that issue there. I’m going to keep this one focused on bitness of the MSBuild libraries and plan to resolve that specific issue soon.