Stay organized with collections Save and categorize content based on your preferences.

Specifying dependencies in .NET

.NET Cloud Functions functions use Microsoft Build Engine (MSBuild) project files. These files are central to the build and deployment process. For C# the file extension is .csproj, for F# it is .fsproj, and for Visual Basic it is .vbproj.

For example, here is the .csproj file for the C# Hello World sample:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Google.Cloud.Functions.Hosting" Version="1.0.0" />
  </ItemGroup>
</Project>

You can add libraries to your function's project file as follows:

dotnet add package MY_LIBRARY

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