aws / aws-toolkit-visual-studio

AWS Toolkit for Visual Studio - a plugin to interact with AWS
https://aws.amazon.com/visualstudio/
Apache License 2.0
108 stars 29 forks source link

Cannot launch in WSL2 filesystem #263

Open tpmccrary opened 2 years ago

tpmccrary commented 2 years ago

Describe the bug When attempting to use the AWS Toolkit on a project that is located in the WSL2 filesystem (\\wsl.localhost) it is unable to find the .csproj file. Error thrown:

{"ErrorCode":"FailedToFindDeployableTarget","Message":"Failed to find a valid .csproj or .fsproj file at path \\\\wsl.localhost\\Ubuntu\\home\\<user>\\<directory>\\<project-name>\\<project-name>.csproj","ProcessExitCode":null}

To Reproduce

  1. Install WSL2 (official docs: https://docs.microsoft.com/en-us/windows/wsl/install).
  2. Create a project in the WSL2 filesystem. My case I created a ASP.NET Web API project at \\wsl.localhost\Ubuntu\home\<user>.
  3. In the Visual Studio editor, right click on the project in the Solution Explorer panel and click "Publish to AWS".
  4. This will attempt to load the AWS Toolkit which will eventually throw the error.

Expected behavior I expect the AWS Toolkit to launch as expected.

Screenshots image

Computer:

ashovlin commented 2 years ago

Thank you for reporting the issue.

It looks like you're running into this check in the underlying deployment tool: https://github.com/aws/aws-dotnet-deploy/blob/0ef3240cd0e6ad1540a3f52870f3197a3973d5e8/src/AWS.Deploy.Common/Utilities/PathUtilities.cs#L18-L19

This was added in https://github.com/aws/aws-dotnet-deploy/pull/311 to disallow deploying projects from Server Message Block (SMB) protocol shared drives, but looks like it's catching WSL paths too. This may not have been intended, we'll have to take a closer look.

I was also able to reproduce with just the CLI version of the tool (from Windows, not WSL) with:

dotnet aws deploy --project-path \\\\wsl$\\Ubuntu\\home\\path\\to\\project.csproj

@awschristou - do you have permission to move this over to https://github.com/aws/aws-dotnet-deploy? If not (or if you'd rather leave this open here), I can create a new issue over there.

awschristou commented 2 years ago

@ashovlin , because the fix would go through a separate deploy tool and Toolkit release, please make a separate issue in aws-dotnet-deploy, and paste the URL to this issue in it (or vice versa). This way the issues will be linked, and we can track progress on the issue.

ashovlin commented 2 years ago

Created https://github.com/aws/aws-dotnet-deploy/issues/628 to track the fix in the underlying CLI.

One possible workaround (albeit a different experience) in the meantime if you're committed to WSL is deploy from the CLI within WSL instead of Visual Studio from Windows:

tpmccrary commented 2 years ago

I'll use that workaround for now. Thanks for looking into this!