--- title: ".Net" slug: "cloudfunctions-example-net" tags: ["Cloud Functions examples", "Cloud Functions"] updated: 2026-09-17T09:18:17Z published: 2026-09-17T09:18:17Z canonical: "guide.ncloud-docs.com/cloudfunctions-example-net" --- > ## Documentation Index > Fetch the complete documentation index at: https://guide.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # .Net Available in Classic and VPC This section describes how to create and use .Net(core) actions in a variety of ways, and includes application examples. Note To compile, test, and compress .NET Core projects, you must install [.NET Core SDK](https://dotnet.microsoft.com/download)locally and set the DOTNET_HOME environment variable to the location of the dotnet executable file. ## Create action To create an action, you must first understand the .NET action structure. .NET Core actions consist of .NET Core libraries and Main function structured as follows: ``` public Newtonsoft.Json.Linq.JObject Main(Newtonsoft.Json.Linq.JObject); ``` Create a C# project named NCP.CloudFunctions.Example.Dotnet to check an example for action creation. ``` dotnet new classlib -n NCP.CloudFunctions.Example.Dotnet -lang "C#" -f netstandard2.0 cd NCP.CloudFunctions.Example.Dotnet ``` Then install [Newtonsoft.Json](https://www.newtonsoft.com/json), [NuGet](https://docs.microsoft.com/ko-kr/nuget/what-is-nuget) packages for using json. ``` dotnet add package Newtonsoft.Json -v 12.0.1 ``` Here's an example of creating an action: 1. Write an action code Hello.cs. ``` using System; using Newtonsoft.Json.Linq; namespace NCP.CloudFunctions.Example.Dotnet { public class Hello { public JObject Main(JObject args) { string name = "stranger"; if (args.ContainsKey("name")) { name = args["name"].ToString(); } JObject message = new JObject(); message.Add("greeting", new JValue($"Hello, {name}!")); return (message); } } } ``` 2. Run the command to publish the project contents. ``` dotnet publish -c Release -o out ``` 3. Run the command to create a zip file of the published contents. ``` cd out zip -r -0 helloDotNet.zip * ``` 4. Create an action by uploading the created zip file. ![cloudfunctions-exmaple-net_v2_01_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example-net_v2_01_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D) - When creating an action in .NET format, you must enter the `Main` function in the format {Assembly}::{Class Full Name}::{Method} as shown in this example. ``` NCP.CloudFunctions.Example.Dotnet::NCP.CloudFunctions.Example.Dotnet.Hello::Main ``` ![cloudfunctions-example-run-dotnet_mainFunc_ko](https://cdn.document360.io/6998976f-9d95-4df8-b847-d375892b92c2/Images/Documentation/cloudfunctions-example-run-dotnet_mainFunc_en.png?sv=2026-02-06&spr=https&st=2026-11-14T04%3A24%3A15Z&se=2026-11-14T05%3A24%3A15Z&sr=c&sp=r&sig=5DRdcfQH0vtNEMZyT2pdKI%2B6SwyiClP%2FHIbWzJsahpU%3D)