Last week I needed an Azure Function to be compiled for the x64 platform because of a dependency. It was a long google search and a lot of try and fail. Looking back it was actually very very easy. Here a summary of what I did to get it working on my local machine using Visual Studio 2017 on Windows 10

Install the CLI & SDK

  • Download the latest Azure Function Core Tools (Azure.Functions.Cli.win-x64.2.0.1-beta.34.zip)
  • Unzip the file (c:\temp\functioncli)
  • Download and install the latest .dotnet Core SDK (.NET Core 2.1)

Create an Azure Function (SDK 2.0)

  • Open a command prompt
  • Create a directory for your new function project
  • Run from the directory above: c:\temp\functioncli\func init MyFunctionProj
  • Select: dotnet
  • Run: c:\temp\functioncli\func extensions install
  • Create a storage account in Azure
  • Copy the storage connection string
  • Put them in * local.settings.json*
{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "<INSERT HERE>",
    "AzureWebJobsDashboard": "<INSERT HERE>",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}
  • Run: c:\temp\functioncli\func new
  • Select the project type you want

Debug your x64 function from Visual Studio

  • Open your project in Visual Studio
  • Open the properties of you project and go to: build and set the Platform target to x64.
  • Then open the Debug properties
  • Select in the dropdown: Launch the value "Executable"
  • By executable type: c:\temp\functioncli\func
  • By Application Arguments type: host start
  • By working directory type: $(TargetDir)

af_001

Now you are done, hit debug and your Azure Function will locally run for a x64 platform.

Recourses