VS Community - Cannot run a simple console application: Could not load file or assembly ‘System.Reflection.Metadata'

1

I’ve installed Microsoft Visual Studio Community 2019 Version 16.9.4 and tried to create a simple console application to print “Hello World”.

If I run the app with dotnet run from the Windows Command Prompt, it will run successfully, but opening the project in VS and trying to start the console app is causing the following error:

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly ‘System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)

I’ve already tried to start the console app as x86 and x64, but that did not help.

Another attempt was to uninstall VS 2019 and install VS 2017 Community. Have the same exception when I build the console app.

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The file or directory is corrupted and unreadable. (Exception from HRESULT: 0x80070570)

Could someone please help me with this?

visual-studio
visual-studio-2019
badimageformatexception
visual-studio-2017-build-tools
asked on Stack Overflow Apr 29, 2021 by felipe.zkn • edited Apr 30, 2021 by felipe.zkn

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0