[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[[["\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)."]]