0

I get such an error when I run the project.

'System.BadImageFormatException: 'Could not load file or assembly 'Core.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Format of the executable (.exe) or library (.dll) is invalid.''

Project> Properties> Build> Platform Target: Any CPU selected.

1 Answers1

0

I got the same error some time ago.

Somehow, one of the project's .dll was deleted and it wasn't being loaded anymore.

What to do

If your situation is the same as I past throw, here is how you should proceed:

Step 1

As you can see, my solution Criativa contains a C# project library called Criativa.Infra.Repository, when accessing the obj > Debug > net6.0 we will find no .dll, and this is possibly your problem.

enter image description here

Step 2

To fix it, open the solution on Visual Studio, find your project, click with the right button, and select "Rebuild".

enter image description here

Finish

After these steps, if your problem was the non-existence of the .dll file, it will be running now.

enter image description here

Best regards, Angelo.