Question: I am new to CI/CD and trying to deploy a simple serverless function through Jenkins and getting error.

Here are my steps

1. Create a new project using dotnet new serverless.AspNetCoreWebAPI
2. Configured Git source {GitHub} where this project is located.
3. Added following lines in Build Step

`export PATH=$PATH:/usr/local/share/dotnet:/usr/local/bin

dotnet lambda deploy-serverless`

After running the above command I get the error

> 
> /usr/local/share/dotnet/dotnet lambda deploy-serverless Could not execute because the specified command or file was not found. Possible reasons for this include:  
> 
>  You misspelled a built-in dotnet command.  
> 
>  You intended to execute a .NET Core program, but dotnet-lambda does not exist.  
> 
>  You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.  
> 
>  Build step 'Execute shell' marked build as failure Finished: FAILURE
> 
> 
> 

Needless to say I can successfully run dotnet lambda deploy-serverless if using terminal window.

Any idea what's wrong here?

Answer: 
Install first below command in CMD 

> 
> dotnet tool install -g Amazon.Lambda.Tools
> 
> 
> 

Then you can find dotnet command in cmd.
Solved the issue finally.

> 
> Compared the .csproj files one for successful lambda deployment and one where it was failing. Noticed that following lines were the difference. It worked as soon as I added the below in my project file.
> 
> 
> 

```
<ItemGroup><DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.2.0" /></ItemGroup>

```

It will be still interesting to know that why dotnet lambda deploy-serverless works from terminal window for the same project without the above line but not from inside jenkins job.