Aws-lambda-dotnet: "Mock Lambda Test Tool in launchsettings.json

Created on 14 Feb 2019  路  14Comments  路  Source: aws/aws-lambda-dotnet

Because this is in launchsettings.json and because the executablePath contains the current users directory, when launchsettings.json gets pushed to a git repository, it will mess up other users.

e.g. Normj will have in launchsettings.json
"executablePath": "C:\Users\NormJ\.dotnet\tools\dotnet-lambda-test-tool-2.1.exe",

When he pushes his git repository to me, I will get this executablePath and will find that I cannot run the test tool.

feature-request

Most helpful comment

Please, replace

"executablePath": "C:\\Users\\%USERNAME%\\.dotnet\\tools\\dotnet-lambda-test-tool-2.1.exe"
to
"executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-2.1.exe"

and enjoy forever!

All 14 comments

I was just going to enter the same issue. I tried replacing the username part of it with %USERNAME% but it just gets replaced by my username when I reopen visual studio.

Thanks for the suggestion of using %USERNAME% instead of updating the file when the project is opened. I'll need to update the AWS Toolkit for that change which is in the middle of work for VS 2019. Unless you folks tell me this is high priority it will probably get lumped into that work.

Also running into this issue. A linked issue for me is that I am overriding the workingDirectory property and this gets reset each time I re-open visual studio.

I have made the fix in my internal branch of the VS toolkit to add support for VS 2019. (Sorry the toolkit isn't open sourced). The fix will also be in VS 2017. I also change the code to only set workingDirectory when the launchsettings.json file is first being written to for the Lambda test tool.

Brilliant thank you

@normj Is there any chance the toolkit will be open sourced?

Thanks Norm

@andymac4182 I would like to get the toolkit open sourced but that is a decent amount of engineering effort I just haven't found the time for.

Can we help you with that :-)

Please, replace

"executablePath": "C:\\Users\\%USERNAME%\\.dotnet\\tools\\dotnet-lambda-test-tool-2.1.exe"
to
"executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-2.1.exe"

and enjoy forever!

I second wsalmi's suggestion... %USERNAME% doesn't work correctly for me, I change it to %USERPROFILE% but it keeps changing back which is frustrating.

Riffing off of @wsalmi, please consider replacing the "workingDirectory" value as well.

From: "workingDirectory": ".\bin\Debug\netcoreapp2.1"
To: "workingDirectory": ".\bin\$(Configuration)\netcoreapp2.1"

Version 1.16.0.0 of the AWS Toolkit of Visual Studio went out last week which will now use %USERNAME% for setting up the executablePath.

@jerhewet That is a good suggestion. I'll make that change to the toolkit.

@jerhewet Version 0.10.0 went out today with your suggestion of using $(Configuration)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

martincostello picture martincostello  路  4Comments

CrazyBaran picture CrazyBaran  路  7Comments

ibuchan72390 picture ibuchan72390  路  7Comments

JustinGrote picture JustinGrote  路  5Comments