You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/create-first-function-vs-code-csharp.md
+19-30Lines changed: 19 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,16 @@
2
2
title: "Create a C# function using Visual Studio Code - Azure Functions"
3
3
description: "Learn how to create a C# function, then publish the local project to serverless hosting in Azure Functions using the Azure Functions extension in Visual Studio Code. "
# Quickstart: Create a C# function in Azure using Visual Studio Code
15
11
16
-
This article shows you how to create C# functions that run on .NET 6 [in the same process as the Functions host](functions-dotnet-class-library.md). These _in-process_ C# functions are only supported on [Long Term Support (LTS)](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) .NET versions, such as .NET 6. When creating your project, you can choose to instead create a function that runs on .NET 6 in an [isolated worker process](dotnet-isolated-process-guide.md). [Isolated worker process](dotnet-isolated-process-guide.md) supports both LTS and Standard Term Support (STS) versions of .NET. For more information, see [Supported versions](dotnet-isolated-process-guide.md#supported-versions) in the .NET Functions isolated worker process guide. There's also a [CLI-based version](create-first-function-cli-csharp.md) of this article.
12
+
This article creates an HTTP triggered function that runs on .NET. For information about .NET versions supported for C# functions, see [Supported versions](dotnet-isolated-process-guide.md#supported-versions).
13
+
14
+
There's also a [CLI-based version](create-first-function-cli-csharp.md) of this article.
17
15
18
16
Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
19
17
@@ -32,41 +30,30 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
32
30
:::image type="content" source="./media/functions-create-first-function-vs-code/create-new-project.png" alt-text="Screenshot of create a new project window.":::
33
31
34
32
1. Select the directory location for your project workspace and choose **Select**. You should either create a new folder or choose an empty folder for the project workspace. Don't choose a project folder that is already part of a workspace.
33
+
34
+
1. For **Select a language**, choose `C#`.
35
+
36
+
1. For **Select a .NET runtime**, choose from one of the following options:
37
+
38
+
| .NET runtime | Process model | Description |
39
+
| --- | --- | --- |
40
+
|**.NET 6.0 (LTS)**|[In-process](functions-dotnet-class-library.md)|_In-process_ C# functions are only supported on [Long Term Support (LTS)](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) .NET versions. Function code runs in the same process as the Functions host. |
41
+
|**.NET 6.0 Isolated (LTS)**|[Isolated worker process](dotnet-isolated-process-guide.md)| Functions run on .NET 6, but in a separate process from the Functions host. |
42
+
|**.NET 7.0 Isolated**|[Isolated worker process](dotnet-isolated-process-guide.md)| Because .NET 7 isn't an LTS version of .NET, your functions must run in an isolated process on .NET 7. |
43
+
|**.NET Framework Isolated**|[Isolated worker process](dotnet-isolated-process-guide.md)| Choose this option when your functions need to use libraries only supported on the .NET Framework. |
35
44
36
-
1. Provide the following information at the prompts:
45
+
The two process models use different APIs, and each process model uses a different template when generating the function project code. If you don't see these options, press F1 and type `Preferences: Open user settings`, then search for `Azure Functions: Project Runtime` and make sure that the default runtime version is set to `~4`.
37
46
38
-
# [In-process](#tab/in-process)
47
+
1. Provide the remaining information at the prompts:
39
48
40
49
|Prompt|Selection|
41
50
|--|--|
42
-
|**Select a language**|Choose `C#`.|
43
-
|**Select a .NET runtime**| Select `.NET 6`.|
44
51
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
45
52
|**Provide a function name**|Type `HttpExample`.|
46
53
|**Provide a namespace**| Type `My.Functions`. |
47
54
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. To learn about authorization level, see [Authorization keys](functions-bindings-http-webhook-trigger.md#authorization-keys).|
48
55
|**Select how you would like to open your project**|Select `Add to workspace`.|
49
56
50
-
# [Isolated process](#tab/isolated-process)
51
-
52
-
|Prompt|Selection|
53
-
|--|--|
54
-
|**Select a language**|Choose `C#`.|
55
-
|**Select a .NET runtime**| Choose `.NET 6 Isolated`.|
56
-
|**Select a template for your project's first function**|Choose `HTTP trigger`.|
57
-
|**Provide a function name**|Type `HttpExample`.|
58
-
|**Provide a namespace**| Type `My.Functions`. |
59
-
|**Authorization level**|Choose `Anonymous`, which enables anyone to call your function endpoint. To learn about authorization level, see [Authorization keys](functions-bindings-http-webhook-trigger.md#authorization-keys).|
60
-
|**Select how you would like to open your project**|Choose `Add to workspace`.|
61
-
62
-
---
63
-
64
-
> [!NOTE]
65
-
> If you don't see .NET 6 as a runtime option, check the following:
66
-
>
67
-
> + Make sure you have installed the .NET 6.0 SDK or other available .NET SDK versions, from .NET website [here](https://dotnet.microsoft.com/download).
68
-
> + Press F1 and type `Preferences: Open user settings`, then search for `Azure Functions: Project Runtime` and change the default runtime version to `~4`.
69
-
70
57
1. Visual Studio Code uses the provided information and generates an Azure Functions project with an HTTP trigger. You can view the local project files in the Explorer. For more information about the files that are created, see [Generated project files](functions-develop-vs-code.md?tabs=csharp#generated-project-files).
@@ -85,6 +72,8 @@ After checking that the function runs correctly on your local computer, it's tim
85
72
86
73
You have used [Visual Studio Code](functions-develop-vs-code.md?tabs=csharp) to create a function app with a simple HTTP-triggered function. In the next article, you expand that function by connecting to either Azure Cosmos DB or Azure Queue Storage. To learn more about connecting to other Azure services, see [Add bindings to an existing function in Azure Functions](add-bindings-existing-function.md?tabs=csharp).
87
74
75
+
The next article depends on your chosen process model.
0 commit comments