Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Especifica dependencias en .NET
Las versiones de .NET de Cloud Run Functions usan archivos de proyecto de Microsoft Build Engine (MSBuild).
Estos archivos son centrales para el proceso de compilación y de implementación. La extensión de archivo es .csproj en C#, .fsproj para F# y .vbproj para Visual Basic.
Por ejemplo, este es el archivo .csproj para la muestra de Hello World de C#:
Puedes agregar bibliotecas al archivo de proyecto de tu función de la siguiente manera:
dotnet add package MY_LIBRARY
Functions Framework es una
dependencia obligatoria para todas las funciones. Aunque las funciones de Cloud Run las instala en tu nombre cuando se crea la función, te recomendamos que la incluyas como una dependencia explícita para brindar mayor claridad.
Si tu
función depende de dependencias privadas, te recomendamos que
dupliques functions-framework en tu registro privado. Incluye el functions-framework duplicado
como una dependencia en tu función para evitar la instalación del
paquete desde la Internet pública.
Para obtener más información sobre las dependencias y otros tipos de personalización, consulta Customization through Functions Startup classes (Personalización mediante clases de Functions Startup).
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]