aws-lambda-dotnet
aws-lambda-dotnet copied to clipboard
`dotnet new` generates project in src folder
Describe the bug
dotnet new generates project in src folder, handling the --name and --output parameter incorrectly.
Let's use the following command as example 1:
dotnet new serverless.AspNetCoreMinimalAPI --name MyLambdaMinimalApi --output .
And the following as example 2:
dotnet new serverless.AspNetCoreMinimalAPI --name MyLambdaMinimalApi --output MyFolder
Expected Behavior
1: The expected result would be to generate the project files in the current folder because --output ., but the project name should be MyLambdaMinimalApi.csproj.
2: The expected result would be a folder MyFolder with the project files in it including the MyLambdaMinimalApi.csproj project file.
Current Behavior
1: The actual result is an src folder with a MyLambdaMinimalApi subfolder, with the project files in it. 2: The actual result is a MyFolder folder with a src subfolder, with a MyLambdaMinimalApi subfolder, with the project files in it.
Reproduction Steps
(Commands above)
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Lambda templates 6.2.0
Targeted .NET Platform
.NET 6
Operating System and version
macOS 12.5
Hi @Swimburger,
Thanks for reporting the issue. The output of the dotnet new serverless.AspNetCoreMinimalAPI --name MyLambdaMinimalApi --output . command is controlled by the Lambda Blueprint template which defines the top level structure with src as parent folder. The --output parameter specified the location to place the generated output and is controlled by the .NET CLI.
Thanks, Ashish
If I understand correctly, the --name and --output argument is handled by .NET CLI (not part of this project), but it's the src folder that is injected by the AWS templates? Should /src be removed from template.json to make it consistent with other project templates?
If I understand correctly, the
--nameand--outputargument is handled by .NET CLI (not part of this project), but it's the src folder that is injected by the AWS templates? Should/srcbe removed from template.json to make it consistent with other project templates?
@Swimburger This needs discussion with the team.
Marking this as feature request since this is working as designed. May be we could include a switch which controls the creation of test folder. If not we default to the user's scenario.
I'm not aware of a test folder. I want project templates to behave like the default .NET SDK project templates.
Related GitHub issue https://github.com/aws/aws-lambda-dotnet/issues/1412