-
Notifications
You must be signed in to change notification settings - Fork 437
Contributor Get Started Guide
Get started guide for Functions Core Tools developers and contributors.
- .NET Core Framework v3.1.0
- .NET 6.0
- .NET 8.0
You can build the CLI using the build.ps1
script or using dotnet build
and dotnet publish
for your platform.
The build.p1s script is used in the CI pipelines to build the Core Tools CLI for all platforms, and prepare for deployment:
-
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.
- This will create an
-
Set
FUNC_PATH
to the path of the CLI for your choosen platform from theartifacts
folderexport FUNC_PATH=/Users/likasem/source/functions/azure-functions-core-tools/artifacts/osx-arm64/func
NOTE: Do not use the
_net8
artifacts for testing, the templates folder does not get copied into the_net8
artifacts; and when you try to run the CLI with the_net8
artifacts, you will get an error:No templates or subcommands found matching: 'func'.
. TBD if this is a bug or expected.
An alternative, and faster approach that just builds the CLI for your platform:
dotnet build Azure.Functions.Cli.sln
-
dotnet publish src/Azure.Functions.Cli/Azure.Functions.Cli.csproj --runtime osx-arm64 --framework net6.0 --output /tmp/cli
- Use the appropriate runtime for your platform i.e.
osx-x64
,linux-x64
,win-x64
,win-arm64
- Use the appropriate runtime for your platform i.e.
export FUNC_PATH=/tmp/cli/func
NOTE: Similar to the note above, do not use
--framework net8.0
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
- Ensure that
FUNC_PATH
environment variable is set to the path of the CLI for your choosen platform from either theartifacts
folder or tmp folderexport FUNC_PATH=/Users/likasem/source/functions/azure-functions-core-tools/artifacts/osx-arm64/func
- OR
export FUNC_PATH=/tmp/cli/func
- Run tests
dotnet test test/Azure.Functions.Cli.Tests/Azure.Functions.Cli.Tests.csproj
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
//TODO: investigate why that is and if it's expected?