Diddley Daddy
Diddley Daddy

Reputation: 11

C# vS2017 project not building: Could not load file or assembly Microsoft.CodeAnalysis

I have a new laptop with Windows 10. I installed the latest Visual Studio 2017. I opened up the c# solution which I had previously been working on a Windows 7 laptop with an older version of Visual Studio 2017 (i.e. not the latest update). The only difference with the setup is that the new install has .net framework 4.6.1 vs 4.8. when I try to build I get the following error:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The module was expected to contain an assembly manifest. C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets 52

I did try to revert back to 4.6.1. I also tried most of the suggested solutions in any previous questions with "could not load file or assembly"

Upvotes: 0

Views: 611

Answers (1)

Diddley Daddy
Diddley Daddy

Reputation: 11

I was able to resolve the issue by reinstalling VS 2017. I had tried this previously to no avail but this time it was successful. One difference was I also uninstalled VS 2019 and only reinstalled VS 2017.

Upvotes: 1

Related Questions