Stay organized with collections Save and categorize content based on your preferences.

The .NET Runtime

Cloud Functions supports the following .NET runtimes:

  • .NET Core 6.0 (recommended)
  • .NET Core 3.1

For instructions on how to prepare your local machine for .NET development, see Setting up a .NET development environment.

To get started with .NET on Cloud Functions, see the Quickstart.

Template package

The template package helps you to create new functions. To use it:

  1. Install .NET Core SDK 3.1.

  2. Install the template package:

    dotnet new -i Google.Cloud.Functions.Templates

Templates are provided for the three kinds of functions in C# (the default), F#, and Visual Basic. When creating a new project from a template, specify -lang f# to create an F# project, or -lang vb to create a Visual Basic project. For more information, see:

Selecting the runtime

You can select the .NET runtime for your function during deployment.


If you are using the Google Cloud CLI, you can specify the runtime by using the --runtime parameter. The --entry-point flag specifies the fully qualified class name (FQN). For example:

gcloud functions deploy NAME --entry-point FQN --runtime dotnet6 --trigger-http

For more arguments that you can specify when you are deploying, see Deploy using the gcloud tool.


If you are using the Google Cloud console, you can select the runtime when you create and deploy a function. See the Google Cloud console quickstart for detailed instructions.

Execution environment

The execution environment includes the runtime, the operating system, and a library that invokes your function.

The .NET runtime uses an execution environment based on Ubuntu. See Cloud Functions execution environment for specific versions and additional information.

The library that invokes your function is the .NET Functions Framework.

Source code structure

In order for Cloud Functions to find your function's definition, each runtime has certain structuring requirements for your source code. See Writing Cloud Functions for more information.

Specifying dependencies

You can specify dependencies for your function by adding them to a project file. For more information, see Specifying dependencies in .NET.

What's next