aws / aws-extensions-for-dotnet-cli

Extensions to the dotnet CLI to simplify the process of building and publishing .NET Core applications to AWS services
Apache License 2.0
369 stars 86 forks source link

`dotnet lambda deploy-function` doesn't respect Directory.Build.props `PublishDir` #261

Closed robertmiles3 closed 1 year ago

robertmiles3 commented 1 year ago

Describe the bug

I currently have a Directory.Build.props file setup for my dev folder. In it, I have defined a particular PublishDir such that all publishes go outside of this main dev folder (because it syncs to the cloud and I don't need publishes synced). However, I've noticed that dotnet lambda deploy-function does not respect this setting.

Expected Behavior

I expect dotnet lambda deploy-function to respect my PublishDir setting in the Directory.Build.props file and thereby write the publish files to the path I've specified.

Current Behavior

Instead, dotnet lambda deploy-function always writes to {project_location}/bin/Release/net6.0/publish regardless. From my logs...

Executing publish command
... invoking 'dotnet publish', working folder '/Users/robertmiles3/Library/CloudStorage/Dropbox/dev/MyApp/src/bin/Release/net6.0/publish'
... dotnet publish --output "/Users/robertmiles3/Library/CloudStorage/Dropbox/dev/MyApp/src/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false

Reproduction Steps

Create a Directory.Build.props file anywhere in the code directory or up the hierarchy. Put the following inside (changing the someuser first)...

<?xml version="1.0" encoding="utf-8"?>
<Project>
    <PropertyGroup>
        <PublishDir>/Users/someuser/dev/artifacts/$(MSBuildProjectName)/bin/$(Configuration)/$(Platform)/</PublishDir>
    </PropertyGroup>
</Project>

Possible Solution

I'm guessing the dotnet lambda deploy-function is only set to use the project's location and go from there. I would suggest attempting to see if PublishDir has been overridden in either the .csproj or the Directory.Build.props.

Additional Information/Context

No response

Targeted .NET platform

.NET 6

CLI extension version

Package Id                Version       Commands
----------------------------------------------------------
amazon.lambda.tools       5.4.5         dotnet-lambda

Environment details (OS name and version, etc.)

macOS Ventura 13.1

ashishdhingra commented 1 year ago

@robertmiles3 This is a duplicate of https://github.com/aws/aws-extensions-for-dotnet-cli/issues/211 (which has associated PR https://github.com/aws/aws-extensions-for-dotnet-cli/pull/183). Please feel free to add an upvote on that issue. Closing this as duplicate.

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.