Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Especificar dependências no .NET
O Cloud Run functions para .NET usam
arquivos de projeto do Microsoft Build Engine (MSBuild).
Esses arquivos são essenciais para o processo de criação e
implantação. Para C#, a extensão de arquivo é .csproj, para F# é .fsproj e
para Visual Basic é .vbproj.
Por exemplo, este é o arquivo .csproj para a amostra Hello Worlds de C#:
É possível adicionar bibliotecas ao arquivo de projeto da função da seguinte maneira:
dotnet add package MY_LIBRARY
O Functions Framework é uma
dependência necessária para todas as funções. Embora as funções do Cloud Functions
o instalem em seu nome quando a função é criada, recomendamos
que você a inclua como uma dependência explícita para maior clareza.
Se a função depende de dependências particulares, recomendamos que você
espelhe functions-framework no registro particular. Inclua o functions-framework
espelhado como uma dependência da sua função para evitar a instalação do
pacote pela Internet pública.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-03 UTC."],[[["\u003cp\u003e.NET Cloud Run functions utilize MSBuild project files (e.g., \u003ccode\u003e.csproj\u003c/code\u003e, \u003ccode\u003e.fsproj\u003c/code\u003e, \u003ccode\u003e.vbproj\u003c/code\u003e) which are essential for building and deploying functions.\u003c/p\u003e\n"],["\u003cp\u003eLibraries can be added to a function's project file using the \u003ccode\u003edotnet add package MY_LIBRARY\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe Functions Framework is a required dependency for all functions, and including it explicitly is recommended for clarity.\u003c/p\u003e\n"],["\u003cp\u003eFor private dependencies, mirroring \u003ccode\u003efunctions-framework\u003c/code\u003e to a private registry and using it as a dependency is recommended to avoid installing from the public internet.\u003c/p\u003e\n"]]],[],null,["# Specify dependencies in .NET\n============================\n\n.NET Cloud Run functions use\n[Microsoft Build Engine (MSBuild) project files](https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/web-deployment-in-the-enterprise/understanding-the-project-file).\nThese files are central to the build and deployment\nprocess. For C# the file extension is `.csproj`, for F# it is `.fsproj`, and\nfor Visual Basic it is `.vbproj`.\n\nFor example, here is the `.csproj` file for the C# Hello World sample: \n\n \u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\n \u003cPropertyGroup\u003e\n \u003cOutputType\u003eExe\u003c/OutputType\u003e\n \u003cTargetFramework\u003enet6.0\u003c/TargetFramework\u003e\n \u003c/PropertyGroup\u003e\n\n \u003cItemGroup\u003e\n \u003cPackageReference Include=\"Google.Cloud.Functions.Hosting\" Version=\"2.2.1\" /\u003e\n \u003c/ItemGroup\u003e\n \u003c/Project\u003e\n\nYou can add libraries to your function's project file as follows: \n\n```\ndotnet add package MY_LIBRARY\n```\n\nThe [Functions Framework](/functions/1stgendocs/functions-framework) is a\nrequired dependency for all functions. Although Cloud Run functions\ninstalls it on your behalf when the function is created, we recommend\nthat you include it as an explicit dependency for clarity.\n\nIf your function relies on private dependencies, we recommend that you\nmirror `functions-framework` to your private registry. Include the mirrored\n`functions-framework` as a dependency to your function to avoid installing the\npackage from the public internet.\n\nFor more discussion of dependencies and other types of customization,\nsee [Customization through Functions Startup classes](https://github.com/GoogleCloudPlatform/functions-framework-dotnet/blob/master/docs/customization.md#customization-through-functions-startup-classes)."]]