Symptoms
"Could not load file or assembly 'SourceCode.HostClientAPI' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Getting this error when deploying custom web project (asp.net) with SourceCode assemblies referenced, on iis and iisexpress.
Diagnoses
In K2 blackpearl 4.6.11, SourceCode assemblies are 64 bit, therefore iisexpress and iis application pool needs to be configured to support 64 bit assemblies. Also, need to make sure to get SourceCode 64 bit assemblies from the Blackpearl/HostServer/Bin folder instead of assemblies from the Blackpearl/Bin folder.
Resolution
Copied SourceCode assemblies from the Blackpearl/HostServer/Bin folder and referenced them on the web project. Configure each assembly to copy local (set to True).
Configured iis express to run as 64 bit process per following page:
http://blogs.msdn.com/b/rob/archive/2013/11/14/debugging-vs2013-websites-using-64-bit-iis-express.aspx
If the site is hosted on IIS, need to configure the Application Pool running the site with property of "Enable 32-Bit Appications" to False.