The .NET runtime

Your Cloud Run function runs in an environment consisting of anoperating system version with add-on packages, language support, andthe.NET Functions Frameworklibrary that supports and invokes your function. This environment is identifiedby the language version, and is known as the runtime ID.

Function preparation

You can prepare a function directly from the Google Cloud console or write it onyour local machine and upload it. To prepare your local machine for .NETdevelopment, seeSet up a .NET development environment.

Supported .NET runtimes and base images

RuntimeRuntime IDStacksRuntime base image
.NET 10dotnet10
  • google-24 (default)
  • google-24-full
  • google-24/dotnet10
  • google-24-full/dotnet10
  • .NET 8dotnet8
  • google-22 (default)
  • google-22-full
  • google-22/dotnet8
  • google-22-full/dotnet8
  • .NET 6dotnet6
  • google-22 (default)
  • google-22-full
  • google-22/dotnet6
  • google-22-full/dotnet6
  • .NET Core 3dotnet3 google-18-fullgoogle-18-full/dotnet3

    Template package

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

    1. Install the.NET SDK.

    2. Install the template package:

      dotnet new install Google.Cloud.Functions.Templates
    Note: versions of the .NET SDK earlier than .NET 7 usedotnet new -i insteadofdotnet new install.

    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 Basicproject.

    Select your runtime

    When you deploy your function, you must specify a .NET runtimecorresponding to the target framework in your project file(MyFunction.csproj or similar). You can select one of thesupported .NET runtimes for your function during deployment.

    You can select a runtime version using the Google Cloud console, or thegcloud CLI. Click the tab for instructions on using the tool ofyour choice:

    gcloud

    Specify the.NET base image for your function using the--base-image flag,while deploying your function. For example:

    gcloud run deployFUNCTION \    --source . \    --functionFUNCTION_ENTRYPOINT \    --base-image dotnet10

    Replace:

    • FUNCTION with the name of the function you aredeploying. You can omit this parameter entirely,but you will be prompted for the name if you omit it.

    • FUNCTION_ENTRYPOINT with the entry point to your function inyour source code. This is the code Cloud Run executes when yourfunction runs. The value of this flag must be a function name orfully-qualified class name that exists in your source code.

    For detailed instructions on deploying a function using the gcloud CLI, seeDeploy functions in Cloud Run.

    Console

    You can select a runtime version when you create or update a Cloud Run function in the Google Cloud console. For detailedinstructions on deploying a function, seeDeploy functions in Cloud Run.

    To select a runtime in the Google Cloud console when you create a function, follow these steps:

    1. In the Google Cloud console, go to the Cloud Run page:

      Go to Cloud Run

    2. ClickWrite a function.

    3. In theRuntime list, select a .NET runtime version.

    4. ClickCreate, and wait for Cloud Run to create the serviceusing a placeholder revision.

    5. The console will redirect you to theSourcetab where you can see the source code of your function. ClickSave and redeploy.

    For detailed instructions on updating the runtime version after your function isdeployed, seeRe-deploy new source code.

    Source code structure

    For Cloud Run functions to find your function's definition, yoursource code must follow a specific structure. SeeWrite Cloud Run functions formore information.

    Specifying dependencies

    .NET Cloud Run functions usesMicrosoft Build Engine (MSBuild) project fileswhich are central to the build and deployment process. You can specifydependencies for your function in a project file. For C# the file extension is.csproj, for F# it is.fsproj, and for Visual Basic it is.vbproj.

    For more discussion of dependencies and other types of customization,seeCustomization through Functions Startup classes.

    Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

    Last updated 2026-02-18 UTC.