aws / aws/aws-extensions-for-dotnet-cli

Allow setting msbuild parameters in CloudFormation template

Open
#213 7 comments 1 reaction 0 assignees View on GitHub
feature-request module/cli-ext p2 queued
Dominant language
C#
Stars
393
Forks
90
Avg merge
2d 19m
Merged PRs (30d)
3

Description

### Describe the feature

When deploying a function straight to the Lambda service using the `dotnet lambda deploy-function` command users can specific additional MSBuild parameters passing in the `--msbuild-parameters` switch. When deploying via CloudFormation the project being built is being decided via the location of the project specified in the template via the Code properties. In this context there is not hook for the user to specify additional MSBuild parameters.

### Use Case

For projects that need to pass in additional MSBuild configuration to build correctly for their Lambda deployments.

### Proposed Solution

When building container based functions the Lambda function's metadata in the template contains docker build information.
```
"Function": {
"Type": "AWS::Serverless::Function",
"Properties": {
"PackageType": "Image",
...
},
"Metadata": {
"Dockerfile": "Dockerfile",
"DockerContext": ".",
"DockerTag": ""
}
}
```

We should follow a similar pattern for producing the .NET zip bundle. Something like the following.

```
"Function": {
"Type": "AWS::Serverless::Function",
"Properties": {

...
},
"Metadata": {
"BuildConfiguration": "CustomRelease",
"MSBuildParameters": "/p:SpecialLambdaOptization=true"
}
}
```

### Other Information

_No response_

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### Targeted .NET platform

Any version the tool supports

### CLI extension version

_No response_

### Environment details (OS name and version, etc.)

Any

Contributor guide

Open the contributing guide

Research direction

Start at the CloudFormation deployment path and its handling of Lambda function metadata, then compare it with the existing dotnet lambda deploy-function --msbuild-parameters flow. Done means a template can declare additional MSBuild parameters for .NET zip builds and those values are passed during the build; add or update coverage where the repository's deployment tests support it.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
build-system, cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.