diff --git a/.gitignore b/.gitignore
index 9eba302782..7fd0531fdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -412,12 +412,8 @@ coverage.xml
# Temporary scratch directory used by the tests
tests/integration/buildcmd/scratch
-tests/integration/testdata/buildcmd/Dotnet6/bin
-tests/integration/testdata/buildcmd/Dotnet6/obj
-tests/integration/testdata/buildcmd/Dotnet7/bin
-tests/integration/testdata/buildcmd/Dotnet7/obj
-tests/integration/testdata/buildcmd/Dotnet8/bin
-tests/integration/testdata/buildcmd/Dotnet8/obj
+tests/integration/testdata/buildcmd/Dotnet*/bin
+tests/integration/testdata/buildcmd/Dotnet*/obj
tests/integration/testdata/invoke/credential_tests/inprocess/dotnet/STS/obj
tests/integration/testdata/sync/code/after/dotnet_function/src/HelloWorld/obj/
tests/integration/testdata/sync/code/before/dotnet_function/src/HelloWorld/obj/
diff --git a/samcli/lib/build/workflow_config.py b/samcli/lib/build/workflow_config.py
index 3bb646ab04..b5a250e3df 100644
--- a/samcli/lib/build/workflow_config.py
+++ b/samcli/lib/build/workflow_config.py
@@ -148,6 +148,7 @@ def get_workflow_config(
selectors_by_build_method = {
"makefile": BasicWorkflowSelector(PROVIDED_MAKE_CONFIG),
"dotnet7": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
+ "dotnet": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
"rust-cargolambda": BasicWorkflowSelector(RUST_CARGO_LAMBDA_CONFIG),
}
diff --git a/tests/integration/buildcmd/test_build_cmd_dotnet.py b/tests/integration/buildcmd/test_build_cmd_dotnet.py
index bc9cd9b24c..d2ddbb8769 100644
--- a/tests/integration/buildcmd/test_build_cmd_dotnet.py
+++ b/tests/integration/buildcmd/test_build_cmd_dotnet.py
@@ -25,6 +25,7 @@ class TestBuildCommand_Dotnet_cli_package(BuildIntegDotnetBase):
[
("provided.al2", "Dotnet7", None, None),
("provided.al2", "Dotnet7", None, MountMode.WRITE),
+ ("provided.al2", "Dotnet", None, None),
]
)
@skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE)
@@ -36,7 +37,10 @@ def test_dotnet_al2(self, runtime, code_uri, mode, mount_mode):
"Architectures": "x86_64",
}
- self.template_path = self.template_path.replace("template.yaml", "template_build_method_dotnet_7.yaml")
+ if(mode == "Dotnet"):
+ self.template_path = self.template_path.replace("template.yaml", "template_build_method_dotnet.yaml")
+ else:
+ self.template_path = self.template_path.replace("template.yaml", "template_build_method_dotnet_7.yaml")
self.validate_build_command(overrides, mode, mount_mode)
self.validate_build_artifacts(self.EXPECTED_FILES_PROJECT_MANIFEST_PROVIDED)
diff --git a/tests/integration/testdata/buildcmd/Dotnet/HelloWorld.csproj b/tests/integration/testdata/buildcmd/Dotnet/HelloWorld.csproj
new file mode 100644
index 0000000000..4d93777fdd
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet/HelloWorld.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net8.0
+ true
+ exe
+ bootstrap
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/integration/testdata/buildcmd/Dotnet/Program.cs b/tests/integration/testdata/buildcmd/Dotnet/Program.cs
new file mode 100755
index 0000000000..da7d128ea6
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet/Program.cs
@@ -0,0 +1,38 @@
+using Amazon.Lambda.APIGatewayEvents;
+using Amazon.Lambda.Core;
+using Amazon.Lambda.RuntimeSupport;
+using Amazon.Lambda.Serialization.SystemTextJson;
+using System.Text.Json.Serialization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Net.Http;
+using System.Net.Http.Headers;
+
+namespace HelloWorld;
+
+public class Function
+{
+ ///
+ /// The main entry point for the custom runtime.
+ ///
+ ///
+ private static async Task Main(string[] args)
+ {
+ Func handler = FunctionHandler;
+ await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer())
+ .Build()
+ .RunAsync();
+ }
+
+ public static string FunctionHandler(APIGatewayHttpApiV2ProxyRequest apigProxyEvent, ILambdaContext context)
+ {
+ return "{'message': 'Hello World'}";
+ }
+}
+
+[JsonSerializable(typeof(APIGatewayHttpApiV2ProxyRequest))]
+public partial class MyCustomJsonSerializerContext : JsonSerializerContext
+{
+}
diff --git a/tests/integration/testdata/buildcmd/Dotnet/aws-lambda-tools-defaults.json b/tests/integration/testdata/buildcmd/Dotnet/aws-lambda-tools-defaults.json
new file mode 100644
index 0000000000..11d7dd7a7b
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet/aws-lambda-tools-defaults.json
@@ -0,0 +1,18 @@
+{
+ "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",
+ "function-runtime":"provided.al2023",
+ "function-memory-size" : 256,
+ "function-timeout" : 30,
+ "function-handler" : "HelloWorld::HelloWorld.Function::FunctionHandler"
+}
diff --git a/tests/integration/testdata/buildcmd/template_build_method_dotnet.yaml b/tests/integration/testdata/buildcmd/template_build_method_dotnet.yaml
new file mode 100644
index 0000000000..c20bcc7ade
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/template_build_method_dotnet.yaml
@@ -0,0 +1,38 @@
+iAWSTemplateFormatVersion : '2010-09-09'
+Transform: AWS::Serverless-2016-10-31
+
+Parameteres:
+ Runtime:
+ Type: String
+ CodeUri:
+ Type: String
+ Handler:
+ Type: String
+
+Resources:
+
+ Function:
+ Type: AWS::Serverless::Function
+ Properties:
+ Handler: !Ref Handler
+ Runtime: !Ref Runtime
+ CodeUri: !Ref CodeUri
+ Timeout: 600
+ Metadata:
+ BuildMethod: dotnet
+
+ OtherRelativePathResource:
+ Type: AWS::ApiGateway::RestApi
+ Properties:
+ BodyS3Location: SomeRelativePath
+
+ GlueResource:
+ Type: AWS::Glue::Job
+ Properties:
+ Command:
+ ScriptLocation: SomeRelativePath
+
+ ExampleNestedStack:
+ Type: AWS::CloudFormation::Stack
+ Properties:
+ TemplateURL: https://s3.amazonaws.com/examplebucket/exampletemplate.yml