aws / aws-dotnet-deploy

Opinionated tooling that simplifies deployment of .NET applications to AWS.
https://aws.github.io/aws-dotnet-deploy/
Apache License 2.0
138 stars 32 forks source link

Setting deploy command's --project-path to project file in same folder fails when multiple project files present #829

Closed Kirkaiya closed 5 months ago

Kirkaiya commented 5 months ago

Describe the bug

Command dotnet aws deploy --project-path MyProject.csproj fails when run from within the folder containing the multiple project files:

..\eShop>dotnet aws deploy --project-path eShop.AspNetCore.csproj
Specify which project file to use because this 'C:\eShop' contains more than one project file.

However, if I run the command from one folder higher, and include the folder path, it then works ..\samples>dotnet aws deploy --project-path eShop\eShop.AspNetCore.csproj

The command also works from within the project folder if I pass the absolute path, like this: dotnet aws deploy --project-path C:\eShop\eShop.AspNetCore.csproj

So there is an issue with the handling of the --project-path argument value, when it's specifying a filename in the same folder where the command is run. Trying various relative path tricks (e.g., --project-path ..\eShop\project.csproj) does not work either.

Expected Behavior

Specifying the filename as --project-path should work when the command is run within the same folder as the project files.

Current Behavior

The deploy command gives the following error:

Specify which project file to use because this 'C:\eShop' contains more than one project file.

Reproduction Steps

In a folder containing a .NET project, create an additional project file (.csproj for C#) with a different name. Then, open a terminal/console to that path. Then run dotnet aws deploy --project-path <one of the project filenames>

Possible Solution

The code that handles the relative paths or path resolution of the --project-path parameter has a bug. I have not looked at the source code for where the bug is.

Additional Information/Context

No response

Version used

1.20.8+645648dd1e

Operating System and version

Windows 11 Version 10.0.22621 Build 22621

normj commented 5 months ago

Interesting the error is actually coming from the dotnet CLI not our tool. Looks like when you run dotnet aws before dotnet forwards to us it is running into confusion about the multiple projects.

You can work around this by using dotnet-aws, with the hyphen, which will skip the redirect that happens with the dotnet CLI.

github-actions[bot] commented 5 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.