Could not load file or assembly... Windows Azure Website

I hate it when i do this. Post a question on SO because I've been trying all day, then i fix it 10 minutes after.

So it seem's i missed a piece of key information which would of helped a lot.

BadImageFormatException

This (as far as i can tell) is thrown when there are problems with the PLATFORM (architecture) compatibility (x86, x64). All of my projects were compiled for "Any CPU" (can be found under project properties > Build > Platform Target, VS2013).

However my "Lib" project was built for x64 only, and the Azure Web Site was running in 32bit mode so was not able to load the 64 bit dll.

Two options:

  1. Compile the "Lib" dll as AnyCPU or 32bit then re-publish
  2. Switch the azure web site to 64 bit.

I wen't with option 2 because of what the "Lib" dll does I need it as 64 bit.

So for future reference if anyone else has something like this, check the following:

  1. Azure website Platform (found under Configure> Platform, on the old portal)
  2. Check all your project's are set for any CPU or a compatible "Platform (architecture)"

I hope this helps someone else.

Thanks

Steve

EDIT: If anyone else has some more useful information to add for people in the future which might have this problem, please do.