Azure Function x64 Gotcha

This was super annoying when I ran into it.

I was playing with Azure function for a bit and because our app needs to be 64 bits for dependency reason, I made a simple Azure Function v2 to apply the serverless technology for this situation.

However, what was working as a straight copy and paste working app now stopps working somehow. For no reasons at all.

All I did was changing the build to x64 from x86 and it stopped and died with errors similar to this:

[2019-12-22 19:30:04] A host error has occurred during startup operation '2236efae-de7b-4b80-9569-a009ede8c172'.
[2019-12-22 19:30:04] System.Private.CoreLib: Could not load file or assembly 'AzureIntegration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

With NO OTHER details whatsoever.

It turned out, by default Visual Studio 2019 create 32 bit Azure Function projects and if I change it to x64 bits, the AzureFunction CLI for local debugging needs to be x64 bit as well. So, follow this guide fixed the problem:

https://github.com/Azure/azure-functions-core-tools/wiki/Running-64bit-functions-in-Visual-Studio

Basicly, download the x64 release of the azure function core tool and then set “Debug” to launch executable, pointing to the func.exe from the download and then add application arguments of “host start” and then it is all launching fine!

Really hope this will not be an issue in the future.

Thanks to Henk Boelman’s blog entry to point me to start at least investigating the x64 as the beginning of this issue: https://www.henkboelman.com/articles/azure-function-x64-dev-setup/