From 0ce327759d168ae11935c20494e49b4991239904 Mon Sep 17 00:00:00 2001 From: Stuart Lang Date: Sun, 27 Feb 2022 20:58:13 +0000 Subject: [PATCH] feat: Update `.net` examples to .NET 6 (#682) --- legacy/aws-csharp/Handler.cs | 44 ++++++++++++++--------------- legacy/aws-csharp/aws-csharp.csproj | 14 ++++++--- legacy/aws-csharp/build.cmd | 4 +-- legacy/aws-csharp/build.sh | 4 +-- legacy/aws-csharp/serverless.yml | 4 +-- legacy/aws-fsharp/aws-fsharp.fsproj | 7 +++-- legacy/aws-fsharp/build.cmd | 4 +-- legacy/aws-fsharp/build.sh | 4 +-- legacy/aws-fsharp/serverless.yml | 4 +-- 9 files changed, 47 insertions(+), 42 deletions(-) diff --git a/legacy/aws-csharp/Handler.cs b/legacy/aws-csharp/Handler.cs index 4c526b5d0..ed667eade 100644 --- a/legacy/aws-csharp/Handler.cs +++ b/legacy/aws-csharp/Handler.cs @@ -1,31 +1,29 @@ -using Amazon.Lambda.Core; - [assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] -namespace AwsDotnetCsharp + +namespace AwsDotnetCsharp; +public class Handler { - public class Handler + public Response Hello(Request request) { - public Response Hello(Request request) - { - return new Response("Go Serverless v1.0! Your function executed successfully!", request); - } + return new Response("Go Serverless v1.0! Your function executed successfully!", request); } +} - public class Response - { - public string Message {get; set;} - public Request Request {get; set;} +public class Response +{ + public string Message {get; set;} + public Request Request {get; set;} - public Response(string message, Request request){ - Message = message; - Request = request; - } - } + public Response(string message, Request request) + { + Message = message; + Request = request; + } +} - public class Request - { - public string Key1 {get; set;} - public string Key2 {get; set;} - public string Key3 {get; set;} - } +public class Request +{ + public string Key1 {get; set;} + public string Key2 {get; set;} + public string Key3 {get; set;} } diff --git a/legacy/aws-csharp/aws-csharp.csproj b/legacy/aws-csharp/aws-csharp.csproj index c5b12e6c0..eb6b0c7e4 100644 --- a/legacy/aws-csharp/aws-csharp.csproj +++ b/legacy/aws-csharp/aws-csharp.csproj @@ -1,15 +1,21 @@  - netcoreapp3.1 - true + net6.0 CsharpHandlers aws-csharp + true + true + enable - - + + + + + + diff --git a/legacy/aws-csharp/build.cmd b/legacy/aws-csharp/build.cmd index 61537bee6..7924be865 100644 --- a/legacy/aws-csharp/build.cmd +++ b/legacy/aws-csharp/build.cmd @@ -1,3 +1,3 @@ dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip diff --git a/legacy/aws-csharp/build.sh b/legacy/aws-csharp/build.sh index daadffd82..506e16c08 100755 --- a/legacy/aws-csharp/build.sh +++ b/legacy/aws-csharp/build.sh @@ -8,5 +8,5 @@ then fi dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/hello.zip +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/hello.zip diff --git a/legacy/aws-csharp/serverless.yml b/legacy/aws-csharp/serverless.yml index 3eeec6bff..11565d72f 100644 --- a/legacy/aws-csharp/serverless.yml +++ b/legacy/aws-csharp/serverless.yml @@ -22,7 +22,7 @@ frameworkVersion: '3' provider: name: aws - runtime: dotnetcore3.1 + runtime: dotnet6 # you can overwrite defaults here # stage: dev @@ -59,7 +59,7 @@ functions: # you can add packaging information here package: - artifact: bin/Release/netcoreapp3.1/hello.zip + artifact: bin/Release/net6.0/hello.zip # exclude: # - exclude-me.js # - exclude-me-dir/** diff --git a/legacy/aws-fsharp/aws-fsharp.fsproj b/legacy/aws-fsharp/aws-fsharp.fsproj index 51c46416a..a33348ef8 100644 --- a/legacy/aws-fsharp/aws-fsharp.fsproj +++ b/legacy/aws-fsharp/aws-fsharp.fsproj @@ -1,9 +1,10 @@  - netcoreapp3.1 + net6.0 FsharpHandlers aws-fsharp + true @@ -11,8 +12,8 @@ - - + + diff --git a/legacy/aws-fsharp/build.cmd b/legacy/aws-fsharp/build.cmd index 7b1550086..aabcd923e 100644 --- a/legacy/aws-fsharp/build.cmd +++ b/legacy/aws-fsharp/build.cmd @@ -1,4 +1,4 @@ dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip \ No newline at end of file +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip diff --git a/legacy/aws-fsharp/build.sh b/legacy/aws-fsharp/build.sh index cfd8e9bf9..a31cb7c15 100644 --- a/legacy/aws-fsharp/build.sh +++ b/legacy/aws-fsharp/build.sh @@ -8,5 +8,5 @@ then fi dotnet restore -dotnet tool install -g Amazon.Lambda.Tools --framework netcoreapp3.1 -dotnet lambda package --configuration Release --framework netcoreapp3.1 --output-package bin/Release/netcoreapp3.1/deploy-package.zip \ No newline at end of file +dotnet tool install -g Amazon.Lambda.Tools --framework net6.0 +dotnet lambda package --configuration Release --framework net6.0 --output-package bin/Release/net6.0/deploy-package.zip diff --git a/legacy/aws-fsharp/serverless.yml b/legacy/aws-fsharp/serverless.yml index 2e946dc40..6513221b8 100644 --- a/legacy/aws-fsharp/serverless.yml +++ b/legacy/aws-fsharp/serverless.yml @@ -22,7 +22,7 @@ frameworkVersion: '3' provider: name: aws - runtime: dotnetcore3.1 + runtime: dotnet6 # you can overwrite defaults here # stage: dev @@ -52,7 +52,7 @@ provider: # you can add packaging information here package: - artifact: bin/Release/netcoreapp3.1/deploy-package.zip + artifact: bin/Release/net6.0/deploy-package.zip # exclude: # - exclude-me.js # - exclude-me-dir/**