Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit c7be0f9

Browse files
authored
Updates for .NET 6. Ran successfully locally (#333)
1 parent 1128a69 commit c7be0f9

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

dotnet/aspnetcore/functionApp/Application/SampleFunctionApp/Function1.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ public static async Task<IActionResult> Run(
2525
dynamic data = JsonConvert.DeserializeObject(requestBody);
2626
name = name ?? data?.name;
2727

28-
return name != null
29-
? (ActionResult)new OkObjectResult($"Hello {name}! Welcome to Azure Functions!")
30-
: (ActionResult)new OkObjectResult("Hello there! Welcome to Azure Functions!");
28+
string responseMessage = string.IsNullOrEmpty(name)
29+
? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
30+
: $"Hello, {name}. This HTTP triggered function executed successfully.";
31+
32+
return new OkObjectResult(responseMessage);
3133
}
3234
}
3335
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.1</TargetFramework>
4-
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
3+
<TargetFramework>net6.0</TargetFramework>
4+
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
7+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
88
</ItemGroup>
99
<ItemGroup>
1010
<None Update="host.json">
@@ -15,4 +15,4 @@
1515
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
1616
</None>
1717
</ItemGroup>
18-
</Project>
18+
</Project>

0 commit comments

Comments
 (0)