Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory.build.props heirarchy is not respected #211

Open
toddlang opened this issue Apr 22, 2022 · 3 comments
Open

Directory.build.props heirarchy is not respected #211

toddlang opened this issue Apr 22, 2022 · 3 comments
Labels
feature-request A feature should be added or improved. module/cli-ext p2 This is a standard priority issue queued

Comments

@toddlang
Copy link

toddlang commented Apr 22, 2022

Describe the bug

When packaging a lambda using dotnet lambda package, if the target project does not include a <TargetFramework> node (because it is defined in a Directory.build.props at a higher location) the packaging tool fails saying it does not know what framework to use.

Missing required parameter: --framework

Expected Behavior

The tool will understand that MSBuild can walk directories searching for Directory.build.props files to define these values.

Current Behavior

The tool fails to walk the folder heirarchy to find the values necessary for the build.

Reproduction Steps

Create a csproj file for a lambda without <TargetFramework>.
In a directory higher (say, next to your sln file) define a 'Directory.build.props' file and add a node there.

This behaviour is all defined here:
https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

dotnet lambda tools 5.3.0

Targeted .NET Platform

.Net 6

Operating System and version

Windows 10

@toddlang toddlang added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 22, 2022
@ashishdhingra ashishdhingra transferred this issue from aws/aws-lambda-dotnet Apr 22, 2022
@ashishdhingra ashishdhingra added A and removed needs-triage This issue or PR still needs to be triaged. labels Apr 22, 2022
@paul-michalik
Copy link

paul-michalik commented May 10, 2022

In connection with AWS SAM this is even worse. If you set for example your directories for temporary and binary directories, or the language version on global level via Directory.build.props then this is ignored by AWS SAM and by dotnet lambda commands.

@chrisoverzero
Copy link

This is something I've tackled in #183.

@ashishdhingra ashishdhingra added module/cli-ext pr/needs-review This PR needs a review from a Member. feature-request A feature should be added or improved. p2 This is a standard priority issue and removed bug This issue is a bug. A labels Nov 1, 2022
@ashishdhingra ashishdhingra removed the pr/needs-review This PR needs a review from a Member. label Jul 17, 2023
@ashovlin
Copy link
Member

Small note: we explored using the new dotnet msbuild -getProperty that was introduced in 17.8 (8.0.1) to detect the target framework in our Lambda Annotations library. We ended up taking a different approach since we were inside a source generator and can access the TFM that way, but linking the abandoned code here in case it's useful.

Here's the commit for reference: aws/aws-lambda-dotnet@357bf99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. module/cli-ext p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

5 participants