Skip to content

Contributor Get Started Guide

Lilian Kasem edited this page Jul 15, 2025 · 9 revisions

Functions Core Tools: Get Started

Get started guide for Functions Core Tools developers and contributors.

Pre-requisites

  • .NET Core Framework v3.1.0
  • .NET 6.0
  • .NET 8.0

Installation

Build

You can build the CLI using the build.ps1 script or using dotnet build and dotnet publish for your platform.

Use build.ps1 script & artifacts

The build.p1s script is used in the CI pipelines to build the Core Tools CLI for all platforms, and prepare for deployment:

  1. Run powershell script to build the project: pwsh build.ps1

    • This will create an artifacts folder in the root directory. This folder contains the CLI build for every platform.
    • You can use these artifacts to run the CLI locally, and to run the tests.
  2. Set FUNC_PATH to the path of the CLI for your choosen platform from the artifacts folder

    • export FUNC_PATH=/Users/likasem/source/functions/azure-functions-core-tools/artifacts/osx-arm64/func

Use dotnet build & publish

An alternative, and faster approach that just builds the CLI for your platform:

  • dotnet build Azure.Functions.Cli.sln
  • dotnet publish src/Cli/func/Azure.Functions.Cli.csproj --runtime osx-arm64 --output /tmp/cli
    • Use the appropriate runtime for your platform i.e. osx-x64, linux-x64, win-x64, win-arm64
  • export FUNC_PATH=/tmp/cli/func

Run

After you have built the CLI and set FUNC_PATH, you can run the CLI like normal e.g:

$FUNC_PATH --help
$FUNC_PATH init
$FUNC_PATH new

Test

  1. Ensure that FUNC_PATH environment variable is set to the path of the CLI for your choosen platform from either the artifacts folder or tmp folder
    • export FUNC_PATH=/Users/likasem/source/functions/azure-functions-core-tools/artifacts/osx-arm64/func
    • OR
    • export FUNC_PATH=/tmp/cli/func
  2. Run tests
    • dotnet test test/Azure.Functions.Cli.Tests/Azure.Functions.Cli.Tests.csproj

Troubleshooting

build.ps1 script: Win32Exception (2): No such file or directory

When running the build.p1s script the following error occurs during the Running Target AddGoZip step:

> go build -o /Users/likasem/source/functions/azure-functions-core-tools/artifacts/min.win-arm64/gozip.exe /Users/likasem/source/functions/azure-functions-core-tools/tools/go/gozip/main.go
Unhandled exception. System.ComponentModel.Win32Exception (2): No such file or directory
   at Build.Shell.InternalExe.Run(Action`1 outputCallback, Action`1 errorCallback) in /Users/likasem/source/functions/azure-functions-core-tools/build/Shell.cs:line 89
   at Build.Shell.Run(String program, String arguments, Boolean streamOutput, Boolean silent) in /Users/likasem/source/functions/azure-functions-core-tools/build/Shell.cs:line 22
   at Build.BuildSteps.AddGoZip() in /Users/likasem/source/functions/azure-functions-core-tools/build/BuildSteps.cs:line 790
   at Build.Orchestrator.Run() in /Users/likasem/source/functions/azure-functions-core-tools/build/Orchestrator.cs:line 69
   at Build.Program.Main(String[] args) in /Users/likasem/source/functions/azure-functions-core-tools/build/Program.cs:line 14

//TODO: investigate and provide a solution

OSX Only: Apple malware warning

If you're trying to test a pre-build of Core Tools that you downloaded from the CI pipeline, you may get an error message:

Apple could not verify “func” is free of malware that may harm your Mac or compromise your privacy.

This is because the packages you're downloading are not notarized and are getting flagged by Gatekeeper. You can remove the quarantine for that by using:

  • xattr -r -d com.apple.quarantine <path-to-func-cli-folder>

Note: do this at your own risk and if you're confident of the source you're getting the CLI from.

Clone this wiki locally