Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad dll file exception when using the Service Fabric template

We are having an issue with Microsoft.ServiceFabric.Actors.dll file in client. When we created the project using the Service Fabric template, the dll file exists in Service, but not in client, then we tried to reference that dll file from the client project, when we run the client, we got:

An unhandled exception of type 'System.BadImageFormatException' occurred in mscorlib.dll Additional information: Could not load file or assembly 'Microsoft.ServiceFabric.Actors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Has anyone had the same issue with dll file, and if so, how should we fix it?

like image 530
Boyang Bai Avatar asked Dec 25 '22 08:12

Boyang Bai


1 Answers

I received the same error when using a client outside of the Service Fabric Application. Make sure your client project is built for the x64 platform.

Follow these steps:
1. Right click on your client project and go to 'Properties'.
2. On the 'Build' tab, set your 'Platform target' to x64.
3. Build your project and use the client.

like image 120
Azhar Samdani Avatar answered Jan 22 '23 04:01

Azhar Samdani