I faced the same issue, both for web applications and when running tests.
When running a web application : : System.BadImageFormatException : "Could not load file or assembly 'Microsoft.ServiceFabric.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Possible cause: your IIS is not setup to run in a 64 bit version. Service Fabric assemblies only run on 64 bit platforms.
Solution: In that case you need to do (as suggested above) in Visual Studio TOOLS > OPTIONS > Projects and Solutions > WEB PROJECTS and check the "Use the 64 bit version of IIS Express for web sites and projects".
When running a test : System.BadImageFormatException : "Could not load file or assembly 'Microsoft.ServiceFabric.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Possible cause: your test runner is not setup to run in a 64 bit version. Service Fabric assemblies only run on 64 bit platforms.
Solution: Change the test runner settings in Visual Studio:
Test menu > Test Settings > Default Processor Architecture > Set to x64.
Also make sure that all your projects are configured to run on x64 platforms, not x86. You can ensure this in the Configuration Manager of your solution, make sure you do not have any active profile for x86.