dotnet new install Google.Cloud.Functions.Templates
C#(기본값), F#, Visual Basic과 같은 3가지 함수 유형의 템플릿이 제공됩니다. 템플릿에서 새 프로젝트를 만들 때는 -lang f#을 지정하여 F# 프로젝트를 만들거나 -lang vb를 지정하여 Visual Basic 프로젝트를 만듭니다. 자세한 내용은 다음을 참고하세요.
.NET Functions Framework의 여러 버전은 다양한 런타임을 지원합니다.
버전 1은 .NET Core 3.1 이상을 지원하며, 템플릿 기본값은 .NET Core 3.1입니다. 버전 2는 .NET 6 이상을 지원하며 템플릿 기본값은 .NET 6입니다.
.NET용 함수 프레임워크 버전 1을 사용하여 기존 프로젝트를 업그레이드하려면 프로젝트 파일을 수정하거나 (Visual Studio를 사용하여) Google.Cloud.Functions로 시작하는 모든 종속 항목을 최신 버전으로 업데이트한 후 대상 프레임워크를 .NET 6으로 설정합니다.
런타임 선택
Cloud Run Functions는 런타임 지원 페이지에 나열된 여러 버전의 .NET을 지원합니다. 함수를 배포할 때 프로젝트 파일(MyFunction.csproj 등)의 대상 프레임워크에 해당하는 .NET 런타임을 지정해야 합니다. .NET 런타임을 지정하려면 다음 안내를 따르세요.
gcloud
Google Cloud CLI를 사용하는 경우 --runtime 매개변수를 사용하여 런타임을 지정합니다. --entry-point 플래그는 정규화된 클래스 이름(FQN)을 지정합니다. 예를 들면 다음과 같습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eCloud Run functions operate within a specific runtime environment, which includes the operating system, add-on packages, language support, and the Functions Framework library.\u003c/p\u003e\n"],["\u003cp\u003eThe .NET template package can be installed via the command \u003ccode\u003edotnet new install Google.Cloud.Functions.Templates\u003c/code\u003e, and supports C#, F#, and Visual Basic for function development.\u003c/p\u003e\n"],["\u003cp\u003eDifferent versions of the .NET Functions Framework are available, with Version 1 supporting .NET Core 3.1 and later, and Version 2 supporting .NET 6 and later, and projects using version 1 can be updated to version 2.\u003c/p\u003e\n"],["\u003cp\u003eWhen deploying a Cloud Run function, you must specify a .NET runtime that matches the target framework set in your project file, using the \u003ccode\u003e--runtime\u003c/code\u003e parameter in the Google Cloud CLI or through the console.\u003c/p\u003e\n"],["\u003cp\u003eDependencies for your .NET Cloud Run function can be specified directly in the project file.\u003c/p\u003e\n"]]],[],null,["# The .NET Runtime\n================\n\nOverview\n--------\n\nYour Cloud Run function runs in an environment consisting of an operating\nsystem version plus add-on packages, language support, and\nthe Functions Framework library that supports and invokes your function.\nThis environment is identified by the language version, and is known as the\nruntime.\n\nFor information about runtimes in general, and to learn which Ubuntu version\neach .NET runtime uses, see the [Cloud Run functions execution\nenvironment](/functions/1stgendocs/concepts/execution-environment#.net-core).\n\nTemplate package\n----------------\n\nThe template package helps you to create new functions. To use it:\n\n1. Install the [.NET SDK](https://dotnet.microsoft.com/download).\n\n2. Install the template package:\n\n dotnet new install Google.Cloud.Functions.Templates\n\n| **Note:** versions of the .NET SDK earlier than .NET 7 use `dotnet new -i` instead of `dotnet new install`.\n\nTemplates are provided for the three kinds of functions in C# (the default), F#,\nand Visual Basic. When creating a new project from a template, specify\n`-lang f#` to create an F# project, or `-lang vb` to create a Visual Basic\nproject. For more information, see:\n\n- [.NET Languages](/functions/1stgendocs/concepts/dotnet-langs) (for F# and Visual Basic)\n\nSelect a .NET Functions Framework version\n-----------------------------------------\n\nDifferent versions of the .NET Functions Framework support different runtimes.\nVersion 1 supports .NET Core 3.1 and later, with templates defaulting to\n.NET Core 3.1. Version 2 supports .NET 6 and later, with templates defaulting\nto .NET 6.\n\nTo upgrade an existing project using .NET Functions Framework version 1,\nedit the project file (or use Visual Studio) to update all dependencies that\nbegin with `Google.Cloud.Functions` to the latest version, and set the\ntarget framework to .NET 6.\n\nSelect your runtime\n-------------------\n\nCloud Run functions supports several versions of .NET, listed on the\n[Runtime support](/functions/1stgendocs/runtime-support#.net-core) page. When you deploy\nyour function, you must specify\na .NET runtime corresponding to the target framework in your project file\n(`MyFunction.csproj` or similar). To specify your .NET runtime: \n\n### gcloud\n\nIf you're using the Google Cloud CLI, specify the runtime\nby using the `--runtime` parameter. The `--entry-point` flag specifies the\nfully qualified class name (FQN). For example: \n\n```bash\ngcloud functions deploy NAME --no-gen2 --entry-point FQN --no-gen2 --runtime dotnet6 --trigger-http\n```\n\nFor more deployment parameters, see\n[Deploy a Cloud Run function](/functions/1stgendocs/deploy#basics).\n\n### Console\n\nIf you're using the Google Cloud console, see the [Google Cloud console\nquickstart](/functions/1stgendocs/console-quickstart-1st-gen) for\ndetailed instructions.\n\nFunction preparation\n--------------------\n\nYou can prepare a function directly from the Google Cloud console or write it on\nyour local machine and upload it. To prepare your local machine for .NET\ndevelopment, see [Setting up a .NET development\nenvironment](/dotnet/docs/setup).\n\nThe library that invokes your function is the\n[.NET Functions Framework](/functions/1stgendocs/functions-framework).\n| **Note:** The only type of [event-driven functions](/functions/1stgendocs/writing#types_of_cloud_functions) .NET supports are [CloudEvent functions](/functions/1stgendocs/writing#cloudevent_functions).\n\nSource code structure\n---------------------\n\nIn order for Cloud Run functions to find your function's definition, each\nruntime has certain structuring requirements for your source code. See [Write\nCloud Run functions](/functions/1stgendocs/writing#functions-writing-file-structuring-csharp)\nfor more information.\n\nSpecifying dependencies\n-----------------------\n\nYou can specify dependencies for your function by adding them to a project file.\nFor more information, see [Specifying dependencies in\n.NET](/functions/1stgendocs/writing/specifying-dependencies-dotnet).\n\nWhat's next\n-----------\n\n- [Learn about the other .NET languages](/functions/1stgendocs/concepts/dotnet-langs) you can use to write Cloud Run functions: F# and Visual Basic."]]