Skip to content

Commit ad11193

Browse files
Updating migration guides
1 parent a3e1f0b commit ad11193

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

articles/azure-functions/migrate-dotnet-to-isolated-model.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ Use one of the following procedures to update this XML file to run in the isolat
110110

111111
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net-framework](../../includes/functions-dotnet-migrate-project-v4-isolated-net-framework.md)]
112112

113+
# [.NET 8 (Preview)](#tab/net8)
114+
115+
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net8](../../includes/functions-dotnet-migrate-project-v4-isolated-net8.md)]
116+
113117
---
114118

115119
### Package and namespace changes
@@ -134,6 +138,10 @@ When migrating to run in an isolated worker process, you must add the following
134138

135139
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="2-20":::
136140

141+
# [.NET 8 (Preview)](#tab/net8)
142+
143+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="23-29":::
144+
137145
---
138146

139147
### local.settings.json file
@@ -202,6 +210,22 @@ public IActionResult Run(
202210

203211
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
204212

213+
214+
# [.NET 8 (Preview)](#tab/net8)
215+
216+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
217+
218+
You can also leverage [ASP.NET Core integration] to instead have the function look more like the following example:
219+
220+
```csharp
221+
[Function("HttpFunction")]
222+
public IActionResult Run(
223+
[HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
224+
{
225+
return new OkObjectResult($"Welcome to Azure Functions, {req.Query["name"]}!");
226+
}
227+
```
228+
205229
---
206230

207231
## Upgrade your function app in Azure

articles/azure-functions/migrate-version-1-version-4.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ Use one of the following procedures to update this XML file to run in Functions
170170

171171
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net-framework](../../includes/functions-dotnet-migrate-project-v4-isolated-net-framework.md)]
172172

173+
# [.NET 8 Preview (isolated)](#tab/net8)
174+
175+
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net8](../../includes/functions-dotnet-migrate-project-v4-isolated-net8.md)]
176+
173177
---
174178

175179
### Package and namespace changes
@@ -192,8 +196,14 @@ Based on the model you are migrating to, you may need to upgrade or change the p
192196

193197
[!INCLUDE [functions-dotnet-migrate-packages-v4-isolated](../../includes/functions-dotnet-migrate-packages-v4-isolated.md)]
194198

199+
# [.NET 8 Preview (isolated)](#tab/net8)
200+
201+
[!INCLUDE [functions-dotnet-migrate-packages-v4-isolated](../../includes/functions-dotnet-migrate-packages-v4-isolated.md)]
202+
195203
---
196204

205+
The [Notification Hubs](./functions-bindings-notification-hubs.md) and [Mobile Apps](./functions-bindings-mobile-apps.md) bindings are supported only in version 1.x of the runtime. When upgrading to version 4.x of the runtime, you need to remove these bindings in favor of working with these services directly using their SDKs.
206+
197207
### Program.cs file
198208

199209
In most cases, migrating requires you to add the following program.cs file to your project:
@@ -214,6 +224,10 @@ A program.cs file isn't required when running in-process.
214224

215225
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="2-20":::
216226

227+
# [.NET 8 Preview (isolated)](#tab/net8)
228+
229+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="23-29":::
230+
217231
---
218232

219233
### host.json file
@@ -238,6 +252,10 @@ To run on version 4.x, you must add `"version": "2.0"` to the host.json file. Yo
238252

239253
:::code language="json" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/host.json":::
240254

255+
# [.NET 8 Preview (isolated)](#tab/net8)
256+
257+
:::code language="json" source="~/functions-quickstart-templates//Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/host.json":::
258+
241259
---
242260

243261
### local.settings.json file
@@ -274,6 +292,13 @@ When you upgrade to version 4.x, make sure that your local.settings.json file ha
274292
> [!NOTE]
275293
> When migrating from running in-process to running in an isolated worker process, you need to change the `FUNCTIONS_WORKER_RUNTIME` value to "dotnet-isolated".
276294
295+
# [.NET 8 Preview (isolated)](#tab/net8)
296+
297+
:::code language="json" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/local.settings.json":::
298+
299+
> [!NOTE]
300+
> When migrating from running in-process to running in an isolated worker process, you need to change the `FUNCTIONS_WORKER_RUNTIME` value to "dotnet-isolated".
301+
277302
---
278303

279304
### Class name changes
@@ -316,6 +341,15 @@ Some key classes changed names between version 1.x and version 4.x. These change
316341
| `HttpRequestMessage` | `HttpRequestData` |
317342
| `HttpResponseMessage` | `HttpResponseData` |
318343

344+
# [.NET 8 Preview (isolated)](#tab/net8)
345+
346+
| Version 1.x | .NET 7 |
347+
| --- | --- |
348+
| `FunctionName` (attribute) | `Function` (attribute) |
349+
| `TraceWriter` | `ILogger<T>`, `ILogger` |
350+
| `HttpRequestMessage` | `HttpRequestData`, `HttpRequest` (using [ASP.NET Core integration])|
351+
| `HttpResponseMessage` | `HttpResponseData`, `IActionResult` (using [ASP.NET Core integration])|
352+
319353
---
320354

321355
[ASP.NET Core integration]: ./dotnet-isolated-process-guide.md#aspnet-core-integration
@@ -385,6 +419,10 @@ In version 4.x, the HTTP trigger template looks like the following example:
385419

386420
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
387421

422+
# [.NET 8 Preview (isolated)](#tab/net8)
423+
424+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
425+
388426
---
389427

390428
::: zone-end

articles/azure-functions/migrate-version-3-version-4.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ Use one of the following procedures to update this XML file to run in Functions
120120

121121
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net-framework](../../includes/functions-dotnet-migrate-project-v4-isolated-net-framework.md)]
122122

123+
# [.NET 8 Preview (isolated)](#tab/net8)
124+
125+
[!INCLUDE [functions-dotnet-migrate-project-v4-isolated-net8](../../includes/functions-dotnet-migrate-project-v4-isolated-net8.md)]
126+
123127
---
124128

125129
### Package and namespace changes
@@ -142,6 +146,10 @@ Based on the model you are migrating to, you may need to upgrade or change the p
142146

143147
[!INCLUDE [functions-dotnet-migrate-packages-v4-isolated](../../includes/functions-dotnet-migrate-packages-v4-isolated.md)]
144148

149+
# [.NET 8 Preview (isolated)](#tab/net8)
150+
151+
[!INCLUDE [functions-dotnet-migrate-packages-v4-isolated](../../includes/functions-dotnet-migrate-packages-v4-isolated.md)]
152+
145153
---
146154

147155
### Program.cs file
@@ -164,6 +172,10 @@ A program.cs file isn't required when running in-process.
164172

165173
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="2-20":::
166174

175+
# [.NET 8 Preview (isolated)](#tab/net8)
176+
177+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Program.cs" range="23-29":::
178+
167179
---
168180

169181
### local.settings.json file
@@ -197,6 +209,13 @@ When you upgrade to version 4.x, make sure that your local.settings.json file ha
197209
> [!NOTE]
198210
> When migrating from running in-process to running in an isolated worker process, you need to change the `FUNCTIONS_WORKER_RUNTIME` value to "dotnet-isolated".
199211
212+
# [.NET 8 Preview (isolated)](#tab/net8)
213+
214+
:::code language="json" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/local.settings.json":::
215+
216+
> [!NOTE]
217+
> When migrating from running in-process to running in an isolated worker process, you need to change the `FUNCTIONS_WORKER_RUNTIME` value to "dotnet-isolated".
218+
200219
---
201220

202221
### Class name changes
@@ -243,6 +262,17 @@ Some key classes changed names between versions. These changes are a result eith
243262
| `IActionResult` | `HttpResponseData` | `HttpResponseData`|
244263
| `FunctionsStartup` (attribute) | Uses [`Program.cs`](#programcs-file) instead | Uses [`Program.cs`](#programcs-file) instead |
245264

265+
# [.NET 8 Preview (isolated)](#tab/net8)
266+
267+
| .NET Core 3.1 | .NET 5 | .NET 7 |
268+
| --- | --- | --- |
269+
| `FunctionName` (attribute) | `Function` (attribute) | `Function` (attribute) |
270+
| `ILogger` | `ILogger` | `ILogger`, `ILogger<T>` |
271+
| `HttpRequest` | `HttpRequestData` | `HttpRequestData`, `HttpRequest` (using [ASP.NET Core integration])|
272+
| `IActionResult` | `HttpResponseData` | `HttpResponseData`, `IActionResult` (using [ASP.NET Core integration])|
273+
| `FunctionsStartup` (attribute) | Uses [`Program.cs`](#programcs-file) instead | Uses [`Program.cs`](#programcs-file) instead |
274+
275+
246276
---
247277

248278
[ASP.NET Core integration]: ./dotnet-isolated-process-guide.md#aspnet-core-integration
@@ -273,6 +303,10 @@ Sames as version 3.x (in-process).
273303

274304
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
275305

306+
# [.NET 8 Preview (isolated)](#tab/net8)
307+
308+
:::code language="csharp" source="~/functions-quickstart-templates/Functions.Templates/Templates/HttpTrigger-CSharp-Isolated/HttpTriggerCSharp.cs":::
309+
276310
---
277311

278312
::: zone-end
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
author: ggailey777
3+
ms.service: azure-functions
4+
ms.topic: include
5+
ms.date: 9/12/2023
6+
ms.author: glenga
7+
---
8+
9+
These steps assume a local C# project, and if your app is instead using C# script (`.csx` files), you should [convert to the project model](../articles/azure-functions/functions-reference-csharp.md#convert-a-c-script-app-to-a-c-project) before continuing.
10+
11+
The following changes are required in the .csproj XML project file:
12+
13+
1. Set the value of `PropertyGroup`.`TargetFramework` to `net8.0`.
14+
15+
1. Set the value of `PropertyGroup`.`AzureFunctionsVersion` to `v4`.
16+
17+
1. Add the following `OutputType` element to the `PropertyGroup`:
18+
19+
:::code language="xml" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Company.FunctionApp.csproj" range="5-5":::
20+
21+
1. Replace the existing `ItemGroup`.`PackageReference` list with the following `ItemGroup`:
22+
23+
:::code language="xml" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Company.FunctionApp.csproj" range="12-15":::
24+
25+
1. Add the following new `ItemGroup`:
26+
27+
:::code language="xml" source="~/functions-quickstart-templates/Functions.Templates/ProjectTemplate_v4.x/CSharp-Isolated/Company.FunctionApp.csproj" range="26-28":::
28+
29+
After you make these changes, your updated project should look like the following example:
30+
31+
```xml
32+
<Project Sdk="Microsoft.NET.Sdk">
33+
<PropertyGroup>
34+
<TargetFramework>net8.0</TargetFramework>
35+
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
36+
<RootNamespace>My.Namespace</RootNamespace>
37+
<OutputType>Exe</OutputType>
38+
<ImplicitUsings>enable</ImplicitUsings>
39+
<Nullable>enable</Nullable>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.18.0" />
43+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.13.0" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<None Update="host.json">
47+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48+
</None>
49+
<None Update="local.settings.json">
50+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
51+
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
52+
</None>
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext"/>
56+
</ItemGroup>
57+
</Project>
58+
```

0 commit comments

Comments
 (0)