diff --git a/.appveyor.yml b/.appveyor.yml
index 857195a3f..998bcf281 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -75,6 +75,9 @@ for:
# setup make
- "choco install make"
+ # install dotnet6
+ - ps: "&powershell -NoProfile -ExecutionPolicy unrestricted -Command \"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -Version 6.0.200 -InstallDir 'C:\\Program Files\\dotnet\\'\""
+
# Echo final Path
- "echo %PATH%"
diff --git a/aws_lambda_builders/validator.py b/aws_lambda_builders/validator.py
index f501e32fd..db1073532 100644
--- a/aws_lambda_builders/validator.py
+++ b/aws_lambda_builders/validator.py
@@ -22,6 +22,7 @@
"java11": [ARM64, X86_64],
"go1.x": [ARM64, X86_64],
"dotnetcore3.1": [ARM64, X86_64],
+ "dotnet6": [ARM64, X86_64],
"provided": [ARM64, X86_64],
}
diff --git a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
index 678a55c24..fce31b746 100644
--- a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
+++ b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py
@@ -31,7 +31,7 @@ def tearDown(self):
shutil.rmtree(self.artifacts_dir)
shutil.rmtree(self.scratch_dir)
- def verify_architecture(self, deps_file_name, expected_architecture):
+ def verify_architecture(self, deps_file_name, expected_architecture, version=None):
deps_file = pathlib.Path(self.artifacts_dir, deps_file_name)
if not deps_file.exists():
@@ -39,7 +39,7 @@ def verify_architecture(self, deps_file_name, expected_architecture):
with open(str(deps_file)) as f:
deps_json = json.loads(f.read())
- version = self.runtime[-3:]
+ version = version or self.runtime[-3:]
target_name = ".NETCoreApp,Version=v{}/{}".format(version, expected_architecture)
target = deps_json.get("runtimeTarget").get("name")
@@ -118,3 +118,77 @@ def test_with_defaults_file_arm64(self):
self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64")
+
+
+class TestDotnet6(TestDotnetBase):
+ """
+ Tests for dotnet 6
+ """
+
+ def setUp(self):
+ super(TestDotnet6, self).setUp()
+ self.runtime = "dotnet6"
+
+ def test_with_defaults_file(self):
+ source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
+
+ self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime)
+
+ expected_files = {
+ "Amazon.Lambda.Core.dll",
+ "Amazon.Lambda.Serialization.Json.dll",
+ "Newtonsoft.Json.dll",
+ "WithDefaultsFile.deps.json",
+ "WithDefaultsFile.dll",
+ "WithDefaultsFile.pdb",
+ "WithDefaultsFile.runtimeconfig.json",
+ }
+
+ output_files = set(os.listdir(self.artifacts_dir))
+
+ self.assertEqual(expected_files, output_files)
+ self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version="6.0")
+
+ def test_with_defaults_file_x86(self):
+ source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
+
+ self.builder.build(
+ source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=X86_64
+ )
+
+ expected_files = {
+ "Amazon.Lambda.Core.dll",
+ "Amazon.Lambda.Serialization.Json.dll",
+ "Newtonsoft.Json.dll",
+ "WithDefaultsFile.deps.json",
+ "WithDefaultsFile.dll",
+ "WithDefaultsFile.pdb",
+ "WithDefaultsFile.runtimeconfig.json",
+ }
+
+ output_files = set(os.listdir(self.artifacts_dir))
+
+ self.assertEqual(expected_files, output_files)
+ self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64", version="6.0")
+
+ def test_with_defaults_file_arm64(self):
+ source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile6")
+
+ self.builder.build(
+ source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=ARM64
+ )
+
+ expected_files = {
+ "Amazon.Lambda.Core.dll",
+ "Amazon.Lambda.Serialization.Json.dll",
+ "Newtonsoft.Json.dll",
+ "WithDefaultsFile.deps.json",
+ "WithDefaultsFile.dll",
+ "WithDefaultsFile.pdb",
+ "WithDefaultsFile.runtimeconfig.json",
+ }
+
+ output_files = set(os.listdir(self.artifacts_dir))
+
+ self.assertEqual(expected_files, output_files)
+ self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64", version="6.0")
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/Function.cs b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/Function.cs
new file mode 100644
index 000000000..23fc86994
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/Function.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+using Amazon.Lambda.Core;
+
+// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
+[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
+
+namespace WithDefaultsFile
+{
+ public class Function
+ {
+
+ ///
+ /// A simple function that takes a string and does a ToUpper
+ ///
+ ///
+ ///
+ ///
+ public string FunctionHandler(string input, ILambdaContext context)
+ {
+ return input?.ToUpper();
+ }
+ }
+}
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/WithDefaultsFile.csproj b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/WithDefaultsFile.csproj
new file mode 100644
index 000000000..5db764810
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/WithDefaultsFile.csproj
@@ -0,0 +1,11 @@
+
+
+ net6.0
+ true
+ Lambda
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/aws-lambda-tools-defaults.json b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/aws-lambda-tools-defaults.json
new file mode 100644
index 000000000..ff2219969
--- /dev/null
+++ b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile6/aws-lambda-tools-defaults.json
@@ -0,0 +1,16 @@
+{
+ "Information": [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+ "dotnet lambda help",
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+ "profile": "",
+ "region": "",
+ "configuration": "Release",
+ "framework": "net6.0",
+ "function-runtime": "dotnet6",
+ "function-memory-size": 256,
+ "function-timeout": 30,
+ "function-handler": "WithDefaultsFile::WithDefaultsFile.Function::FunctionHandler"
+}
\ No newline at end of file