Skip to content

Commit 0ce3277

Browse files
authored
feat: Update .net examples to .NET 6 (#682)
1 parent 765abf6 commit 0ce3277

File tree

9 files changed

+47
-42
lines changed

9 files changed

+47
-42
lines changed

legacy/aws-csharp/Handler.cs

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
using Amazon.Lambda.Core;
2-
31
[assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
4-
namespace AwsDotnetCsharp
2+
3+
namespace AwsDotnetCsharp;
4+
public class Handler
55
{
6-
public class Handler
6+
public Response Hello(Request request)
77
{
8-
public Response Hello(Request request)
9-
{
10-
return new Response("Go Serverless v1.0! Your function executed successfully!", request);
11-
}
8+
return new Response("Go Serverless v1.0! Your function executed successfully!", request);
129
}
10+
}
1311

14-
public class Response
15-
{
16-
public string Message {get; set;}
17-
public Request Request {get; set;}
12+
public class Response
13+
{
14+
public string Message {get; set;}
15+
public Request Request {get; set;}
1816

19-
public Response(string message, Request request){
20-
Message = message;
21-
Request = request;
22-
}
23-
}
17+
public Response(string message, Request request)
18+
{
19+
Message = message;
20+
Request = request;
21+
}
22+
}
2423

25-
public class Request
26-
{
27-
public string Key1 {get; set;}
28-
public string Key2 {get; set;}
29-
public string Key3 {get; set;}
30-
}
24+
public class Request
25+
{
26+
public string Key1 {get; set;}
27+
public string Key2 {get; set;}
28+
public string Key3 {get; set;}
3129
}

legacy/aws-csharp/aws-csharp.csproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
4+
<TargetFramework>net6.0</TargetFramework>
65
<AssemblyName>CsharpHandlers</AssemblyName>
76
<PackageId>aws-csharp</PackageId>
7+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
8+
<PublishReadyToRun>true</PublishReadyToRun>
9+
<ImplicitUsings>enable</ImplicitUsings>
810
</PropertyGroup>
911

1012
<ItemGroup>
11-
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
12-
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.0.1" />
13+
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
14+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.2.0" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<Using Include="Amazon.Lambda.Core" />
1319
</ItemGroup>
1420

1521
</Project>

legacy/aws-csharp/build.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dotnet restore
2-
dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1
3-
dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip
2+
dotnet tool install -g Amazon.Lambda.Tools --framework net6.0
3+
dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip

legacy/aws-csharp/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ then
88
fi
99

1010
dotnet restore
11-
dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1
12-
dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip
11+
dotnet tool install -g Amazon.Lambda.Tools --framework net6.0
12+
dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip

legacy/aws-csharp/serverless.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ frameworkVersion: '3'
2222

2323
provider:
2424
name: aws
25-
runtime: dotnetcore3.1
25+
runtime: dotnet6
2626

2727
# you can overwrite defaults here
2828
# stage: dev
@@ -59,7 +59,7 @@ functions:
5959

6060
# you can add packaging information here
6161
package:
62-
artifact: bin/Release/netcoreapp3.1/hello.zip
62+
artifact: bin/Release/net6.0/hello.zip
6363
# exclude:
6464
# - exclude-me.js
6565
# - exclude-me-dir/**

legacy/aws-fsharp/aws-fsharp.fsproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<AssemblyName>FsharpHandlers</AssemblyName>
66
<PackageId>aws-fsharp</PackageId>
7+
<PublishReadyToRun>true</PublishReadyToRun>
78
</PropertyGroup>
89

910
<ItemGroup>
1011
<Compile Include="Handler.fs" />
1112
</ItemGroup>
1213

1314
<ItemGroup>
14-
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
15-
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.0.1" />
15+
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
16+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.2.0" />
1617
</ItemGroup>
1718

1819
</Project>

legacy/aws-fsharp/build.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dotnet restore
2-
dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1
2+
dotnet tool install -g Amazon.Lambda.Tools --framework net6.0
33

4-
dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip
4+
dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip

legacy/aws-fsharp/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ then
88
fi
99

1010
dotnet restore
11-
dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1
12-
dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip
11+
dotnet tool install -g Amazon.Lambda.Tools --framework net6.0
12+
dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip

legacy/aws-fsharp/serverless.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ frameworkVersion: '3'
2222

2323
provider:
2424
name: aws
25-
runtime: dotnetcore3.1
25+
runtime: dotnet6
2626

2727
# you can overwrite defaults here
2828
# stage: dev
@@ -52,7 +52,7 @@ provider:
5252

5353
# you can add packaging information here
5454
package:
55-
artifact: bin/Release/netcoreapp3.1/deploy-package.zip
55+
artifact: bin/Release/net6.0/deploy-package.zip
5656
# exclude:
5757
# - exclude-me.js
5858
# - exclude-me-dir/**

0 commit comments

Comments
 (0)