Aws lambda 从Visual Studio团队服务部署到AWS Lambda,未找到Dotnet Lamba

Aws lambda 从Visual Studio团队服务部署到AWS Lambda,未找到Dotnet Lamba,aws-lambda,asp.net-core-2.0,azure-pipelines,asp.net-core-webapi,azure-pipelines-build-task,Aws Lambda,Asp.net Core 2.0,Azure Pipelines,Asp.net Core Webapi,Azure Pipelines Build Task,我已经创建了一个.Net Core 2.0 Web API,并尝试使用Visual Studio团队服务和AWS Lambda.Net工具部署它,如下所示: 但当任务在VSTS中运行时,会抛出以下错误: 未找到与命令“dotnet lambda”匹配的可执行文件 以下是任务的完整日志: 2018-01-27T02:55:21.9538582Z ##[section]Starting: Deploy to Lambda: 2018-01-27T02:55:21.9749412Z =======

我已经创建了一个.Net Core 2.0 Web API,并尝试使用Visual Studio团队服务和AWS Lambda.Net工具部署它,如下所示:

但当任务在VSTS中运行时,会抛出以下错误:

未找到与命令“dotnet lambda”匹配的可执行文件

以下是任务的完整日志:

2018-01-27T02:55:21.9538582Z ##[section]Starting: Deploy to Lambda:  
2018-01-27T02:55:21.9749412Z ==============================================================================
2018-01-27T02:55:21.9749717Z Task         : AWS Lambda .NET Core Deployment
2018-01-27T02:55:21.9749955Z Description  : Build and deploy a Serverless .NET Core application or AWS Lambda function
2018-01-27T02:55:21.9750152Z Version      : 1.0.17
2018-01-27T02:55:21.9750334Z Author       : Amazon Web Services
2018-01-27T02:55:21.9750571Z Help         : Please refer to [AWS Lambda Developer Guide](https://docs.aws.amazon.com/lambda/latest/dg/) for more information on working with AWS Lambda.
2018-01-27T02:55:21.9750859Z ==============================================================================
2018-01-27T02:55:23.4482254Z d4194695-5ae1-4063-ab6c-c39aa4079814 exists true
2018-01-27T02:55:23.4524112Z Deploying Lambda project at d:\a\1\s
2018-01-27T02:55:23.4545880Z Beginning dotnet restore
2018-01-27T02:55:23.4729777Z Path to tool: C:\Program Files\dotnet\dotnet.exe
2018-01-27T02:55:23.4760281Z [command]"C:\Program Files\dotnet\dotnet.exe" restore
2018-01-27T02:55:25.2373341Z   Restoring packages for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj...
2018-01-27T02:55:25.2374456Z   Restoring packages for d:\a\1\s\SimOpSolutions.Domain\SimOpSolutions.Domain.csproj...
2018-01-27T02:55:35.5704175Z   Installing System.Threading.Overlapped 4.3.0.
2018-01-27T02:55:35.5879102Z   Installing System.Net.WebHeaderCollection 4.3.0.
2018-01-27T02:55:35.6356230Z   Installing System.Net.NetworkInformation 4.3.0.
2018-01-27T02:55:35.6438188Z   Installing System.Data.Common 4.3.0.
2018-01-27T02:55:35.6990259Z   Installing ServiceStack.Text.Core 5.0.2.
2018-01-27T02:55:35.6999574Z   Installing ServiceStack.Interfaces.Core 5.0.2.
2018-01-27T02:55:35.7024446Z   Installing System.Xml.XmlSerializer 4.3.0.
2018-01-27T02:55:35.7541486Z   Installing System.Net.Requests 4.3.0.
2018-01-27T02:55:35.8301653Z   Installing System.Reflection.DispatchProxy 4.4.0.
2018-01-27T02:55:35.8311199Z   Installing System.Net.Http.WinHttpHandler 4.4.0.
2018-01-27T02:55:35.8311429Z   Installing System.Net.WebHeaderCollection 4.0.1.
2018-01-27T02:55:35.8313073Z   Installing MediatR.Extensions.Microsoft.DependencyInjection 4.0.0.
2018-01-27T02:55:35.8469303Z   Installing MediatR 4.0.1.
2018-01-27T02:55:35.9290745Z   Installing ServiceStack.Common.Core 5.0.2.
2018-01-27T02:55:35.9305266Z   Installing ServiceStack.Client.Core 5.0.2.
2018-01-27T02:55:35.9315268Z   Installing System.Linq.Queryable 4.3.0.
2018-01-27T02:55:36.3981940Z   Installing System.Private.ServiceModel 4.4.0.
2018-01-27T02:55:36.5638519Z   Installing System.Net.Requests 4.0.11.
2018-01-27T02:55:37.1019223Z   Installing Bogus 22.0.2.
2018-01-27T02:55:37.2144033Z   Installing FluentValidation.AspNetCore 7.4.0.
2018-01-27T02:55:38.3640693Z   Installing AWSSDK.DynamoDBv2 3.3.5.
2018-01-27T02:55:38.4332497Z   Installing ServiceStack.Aws.Core 5.0.2.
2018-01-27T02:55:40.1039314Z   Installing FluentValidation 7.4.0.
2018-01-27T02:55:40.4885137Z   Installing AWSSDK.Core 3.3.19.
2018-01-27T02:55:40.7273199Z   Installing AWSSDK.S3 3.3.16.2.
2018-01-27T02:55:44.9860545Z   Installing AWSSDK.SQS 3.3.3.2.
2018-01-27T02:55:45.3974215Z   Installing System.ServiceModel.Primitives 4.4.0.
2018-01-27T02:55:48.0217564Z   Installing AWSSDK.Core 3.3.21.6.
2018-01-27T02:55:48.3023994Z   Installing ServiceStack.Core 5.0.2.
2018-01-27T02:56:24.2979807Z   Installing System.Globalization 4.3.0-preview1-24530-04.
2018-01-27T02:56:24.3991676Z   Installing Microsoft.NETCore.Targets 1.1.0-preview1-24530-04.
2018-01-27T02:56:24.5524420Z   Installing Microsoft.NETCore.Platforms 1.1.0-preview1-24530-04.
2018-01-27T02:56:24.7613877Z   Installing Microsoft.AspNetCore.Http.Features 1.0.3.
2018-01-27T02:56:24.9467558Z   Installing System.Net.WebSockets 4.0.0.
2018-01-27T02:56:25.2402869Z   Installing AWSSDK.CloudFormation 3.3.9.
2018-01-27T02:56:25.3091012Z   Installing Microsoft.Extensions.Localization.Abstractions 1.0.3.
2018-01-27T02:56:25.4939689Z   Installing AWSSDK.IdentityManagement 3.3.5.3.
2018-01-27T02:56:25.5379484Z   Installing Microsoft.DotNet.InternalAbstractions 1.0.0.
2018-01-27T02:56:25.6977057Z   Installing Microsoft.Extensions.ObjectPool 1.0.1.
2018-01-27T02:56:25.9898745Z   Installing Microsoft.AspNetCore.WebUtilities 1.0.3.
2018-01-27T02:56:26.0239197Z   Installing Microsoft.AspNetCore.Routing.Abstractions 1.0.4.
2018-01-27T02:56:26.0953771Z   Installing AWSSDK.Lambda 3.3.12.
2018-01-27T02:56:26.2492646Z   Installing Microsoft.AspNetCore.Hosting.Server.Abstractions 1.0.3.
2018-01-27T02:56:26.2862688Z   Installing AWSSDK.Extensions.NETCore.Setup 3.3.4.
2018-01-27T02:56:26.4454096Z   Installing System.Security.Claims 4.0.1.
2018-01-27T02:56:26.5571073Z   Installing Amazon.Lambda.AspNetCoreServer 2.0.0.
2018-01-27T02:56:26.7962213Z   Installing System.Resources.ResourceManager 4.3.0-preview1-24530-04.
2018-01-27T02:56:26.9275190Z   Installing System.Runtime 4.3.0-preview1-24530-04.
2018-01-27T02:56:27.0346748Z   Installing AWSSDK.Route53 3.3.13.
2018-01-27T02:56:27.0776396Z   Installing EnyimMemcachedCore 2.1.0.2.
2018-01-27T02:56:27.0795680Z   Installing System.Collections 4.3.0-preview1-24530-04.
2018-01-27T02:56:28.1480472Z   Installing System.ComponentModel.Primitives 4.1.0.
2018-01-27T02:56:28.2575492Z   Installing FluentScheduler 5.3.0.
2018-01-27T02:56:28.5952544Z   Installing Amazon.Lambda.Core 1.0.0.
2018-01-27T02:56:29.0640692Z   Installing Amazon.Lambda.Logging.AspNetCore 2.0.0.
2018-01-27T02:56:29.0642148Z   Installing Amazon.Lambda.Serialization.Json 1.1.0.
2018-01-27T02:56:29.4093064Z   Installing Newtonsoft.Json 10.0.3.
2018-01-27T02:56:30.2697878Z   Installing Swashbuckle.AspNetCore 1.1.0.
2018-01-27T02:56:30.2918015Z   Installing System.Runtime.Loader 4.3.0.
2018-01-27T02:56:30.4510158Z   Installing YamlDotNet.Signed 4.3.0.
2018-01-27T02:56:30.7186809Z   Installing Swashbuckle.AspNetCore.SwaggerUI 1.1.0.
2018-01-27T02:56:31.9071285Z   Installing Swashbuckle.AspNetCore.Swagger 1.1.0.
2018-01-27T02:56:32.0019769Z   Installing Swashbuckle.AspNetCore.SwaggerGen 1.1.0.
2018-01-27T02:56:32.4263403Z   Installing AWSSDK.Core 3.3.13.3.
2018-01-27T02:56:33.5812531Z   Installing Microsoft.Extensions.Configuration.Abstractions 1.0.2.
2018-01-27T02:56:33.7809983Z   Installing Microsoft.Extensions.DependencyInjection.Abstractions 1.0.2.
2018-01-27T02:56:33.8890341Z   Installing Amazon.Lambda.APIGatewayEvents 1.1.1.
2018-01-27T02:56:34.0549459Z   Installing Microsoft.AspNetCore.Hosting 1.0.0.
2018-01-27T02:56:34.3940158Z   Installing Microsoft.Extensions.Configuration 1.0.0.
2018-01-27T02:56:34.7082747Z   Installing Microsoft.Extensions.DiagnosticAdapter 1.0.0.
2018-01-27T02:56:34.8651409Z   Installing Microsoft.Extensions.Logging.Abstractions 1.0.0.
2018-01-27T02:56:34.9448306Z   Installing Microsoft.AspNetCore.StaticFiles 1.0.4.
2018-01-27T02:56:34.9454751Z   Installing Microsoft.Extensions.FileProviders.Embedded 1.0.1.
2018-01-27T02:56:35.1961654Z   Installing System.Xml.XPath 4.0.0.
2018-01-27T02:56:35.2657937Z   Installing AutoMapper 6.2.2.
2018-01-27T02:56:35.3431628Z   Installing AWSSDK.CloudFront 3.3.6.1.
2018-01-27T02:56:36.9277797Z   Installing AWSSDK.CognitoIdentity 3.3.2.17.
2018-01-27T02:56:36.9937610Z   Installing AWSSDK.CognitoIdentityProvider 3.3.8.
2018-01-27T02:56:37.0874877Z   Installing Microsoft.IdentityModel.Logging 1.1.5.
2018-01-27T02:56:37.1878915Z   Installing AWSSDK.Route53Domains 3.3.1.3.
2018-01-27T02:56:37.4613163Z   Installing BouncyCastle.NetCore 1.8.1.3.
2018-01-27T02:56:37.5422426Z   Installing Microsoft.IdentityModel.Protocols.OpenIdConnect 2.1.5.
2018-01-27T02:56:37.6076035Z   Installing JWT 3.1.1.
2018-01-27T02:56:37.6904483Z   Installing System.IdentityModel.Tokens.Jwt 5.1.5.
2018-01-27T02:56:37.7316937Z   Installing RestSharp.NetCore 105.2.3.
2018-01-27T02:56:38.0596877Z   Installing Microsoft.AspNetCore.Mvc.Core 1.0.4.
2018-01-27T02:56:38.1068926Z   Installing Microsoft.AspNetCore.Mvc.Formatters.Json 1.0.4.
2018-01-27T02:56:38.1077196Z   Installing Microsoft.AspNetCore.Mvc.ApiExplorer 1.0.4.
2018-01-27T02:56:38.1225080Z   Installing Microsoft.AspNetCore.Mvc.DataAnnotations 1.0.4.
2018-01-27T02:56:39.0309484Z   Installing Microsoft.Extensions.Primitives 1.0.1.
2018-01-27T02:56:39.1692383Z   Installing System.ComponentModel 4.0.1.
2018-01-27T02:56:39.5362783Z   Installing System.Linq.Expressions 4.1.1.
2018-01-27T02:56:40.4614046Z   Installing System.Diagnostics.StackTrace 4.0.1.
2018-01-27T02:56:40.5563460Z   Installing Microsoft.AspNetCore.Hosting.Abstractions 1.0.0.
2018-01-27T02:56:40.5755326Z   Installing Microsoft.AspNetCore.Hosting.Server.Abstractions 1.0.0.
2018-01-27T02:56:40.7212997Z   Installing Microsoft.AspNetCore.Http 1.0.0.
2018-01-27T02:56:40.7777494Z   Installing Microsoft.AspNetCore.Http.Extensions 1.0.0.
2018-01-27T02:56:40.7966177Z   Installing Microsoft.Extensions.FileProviders.Physical 1.0.0.
2018-01-27T02:56:40.8577722Z   Installing Microsoft.Extensions.Options 1.0.0.
2018-01-27T02:56:40.9128086Z   Installing Microsoft.Extensions.DependencyInjection 1.0.0.
2018-01-27T02:56:41.5171542Z   Installing Microsoft.Extensions.PlatformAbstractions 1.0.0.
2018-01-27T02:56:41.5591083Z   Installing Microsoft.Extensions.Configuration.Abstractions 1.0.0.
2018-01-27T02:56:41.6475736Z   Installing Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0.
2018-01-27T02:56:41.8938566Z   Installing Microsoft.AspNetCore.Http.Extensions 1.0.3.
2018-01-27T02:56:45.0979387Z   Installing Microsoft.AspNetCore.Hosting.Abstractions 1.0.4.
2018-01-27T02:56:45.0980587Z   Installing Microsoft.Extensions.FileProviders.Abstractions 1.0.1.
2018-01-27T02:56:45.0981410Z   Installing System.Text.Encodings.Web 4.0.1.
2018-01-27T02:56:45.0982053Z   Installing Microsoft.Extensions.Logging.Abstractions 1.0.2.
2018-01-27T02:56:45.0982656Z   Installing Microsoft.Extensions.WebEncoders 1.0.3.
2018-01-27T02:56:45.0983470Z   Installing AWSSDK.SecurityToken 3.3.3.3.
2018-01-27T02:56:45.0983969Z   Installing Microsoft.IdentityModel.Protocols 2.1.5.
2018-01-27T02:56:45.2247233Z   Installing Microsoft.IdentityModel.Tokens 5.1.5.
2018-01-27T02:56:45.2611182Z   Installing System.ComponentModel.TypeConverter 4.1.0.
2018-01-27T02:56:45.2791682Z   Installing System.Collections.Specialized 4.0.1.
2018-01-27T02:56:45.2846406Z   Installing System.Runtime.Serialization.Formatters 4.3.0-preview1-24530-04.
2018-01-27T02:56:45.8789195Z   Installing Microsoft.AspNetCore.Authorization 1.0.3.
2018-01-27T02:56:45.8789800Z   Installing Microsoft.AspNetCore.Hosting.Abstractions 1.0.3.
2018-01-27T02:56:45.9626175Z   Installing Microsoft.Extensions.Options 1.0.2.
2018-01-27T02:56:45.9769780Z   Installing Microsoft.AspNetCore.Mvc.Abstractions 1.0.4.
2018-01-27T02:56:45.9906831Z   Installing Microsoft.AspNetCore.Http 1.0.3.
2018-01-27T02:56:46.0981601Z   Installing Microsoft.Extensions.DependencyModel 1.0.0.
2018-01-27T02:56:46.4138385Z   Installing Microsoft.AspNetCore.JsonPatch 1.0.0.
2018-01-27T02:56:47.6568391Z   Installing System.ComponentModel.Annotations 4.1.0.
2018-01-27T02:56:47.8091994Z   Installing Microsoft.AspNetCore.Hosting.Server.Abstractions 1.0.4.
2018-01-27T02:56:48.0526415Z   Installing Microsoft.Extensions.Localization 1.0.3.
2018-01-27T02:56:48.1983931Z   Installing Microsoft.AspNetCore.Http.Abstractions 1.0.0.
2018-01-27T02:56:48.2288283Z   Installing Microsoft.Extensions.FileProviders.Abstractions 1.0.0.
2018-01-27T02:56:48.5258234Z   Installing Microsoft.AspNetCore.Http.Features 1.0.0.
2018-01-27T02:56:48.8960676Z   Installing Microsoft.AspNetCore.WebUtilities 1.0.0.
2018-01-27T02:56:49.0181709Z   Installing Microsoft.Extensions.ObjectPool 1.0.0.
2018-01-27T02:56:49.2159622Z   Installing Microsoft.Net.Http.Headers 1.0.0.
2018-01-27T02:56:50.5518262Z   Installing System.IO.FileSystem.Watcher 4.0.0.
2018-01-27T02:56:50.5519211Z   Installing Microsoft.Extensions.FileSystemGlobbing 1.0.0.
2018-01-27T02:56:50.5519880Z   Installing Microsoft.Extensions.Primitives 1.0.0.
2018-01-27T02:56:50.5520167Z   Installing Microsoft.AspNetCore.Http.Abstractions 1.0.3.
2018-01-27T02:56:50.5520585Z   Installing Microsoft.Net.Http.Headers 1.0.3.
2018-01-27T02:57:01.1940712Z d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj : warning NU1603: RestSharp.NetCore 105.2.3 depends on System.Runtime.Serialization.Formatters (>= 4.0.0-rc4-24217-03) but System.Runtime.Serialization.Formatters 4.0.0-rc4-24217-03 was not found. An approximate best match of System.Runtime.Serialization.Formatters 4.3.0-preview1-24530-04 was resolved. [d:\a\1\s\SimOpSolutions.sln]
2018-01-27T02:58:17.0409023Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Domain\obj\SimOpSolutions.Domain.csproj.nuget.g.props.
2018-01-27T02:58:19.4261118Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Domain\obj\SimOpSolutions.Domain.csproj.nuget.g.targets.
2018-01-27T02:58:19.4275775Z   Restore completed in 2.83 min for d:\a\1\s\SimOpSolutions.Domain\SimOpSolutions.Domain.csproj.
2018-01-27T02:58:19.4276367Z   Restoring packages for d:\a\1\s\SimOpSolutions.Infrastructure\SimOpSolutions.Infrastructure.csproj...
2018-01-27T02:58:25.1466415Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.API\obj\SimOpSolutions.API.csproj.nuget.g.props.
2018-01-27T02:58:25.1469733Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.API\obj\SimOpSolutions.API.csproj.nuget.g.targets.
2018-01-27T02:58:25.1683187Z   Restore completed in 3 min for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj.
2018-01-27T02:58:25.1705188Z   Restoring packages for d:\a\1\s\SimOpSolutions.Tasks\SimOpSolutions.Tasks.csproj...
2018-01-27T02:58:25.2725896Z d:\a\1\s\SimOpSolutions.Tasks\SimOpSolutions.Tasks.csproj : warning NU1603: RestSharp.NetCore 105.2.3 depends on System.Runtime.Serialization.Formatters (>= 4.0.0-rc4-24217-03) but System.Runtime.Serialization.Formatters 4.0.0-rc4-24217-03 was not found. An approximate best match of System.Runtime.Serialization.Formatters 4.3.0-preview1-24530-04 was resolved. [d:\a\1\s\SimOpSolutions.sln]
2018-01-27T02:58:25.3842785Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Tasks\obj\SimOpSolutions.Tasks.csproj.nuget.g.props.
2018-01-27T02:58:25.3849002Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Tasks\obj\SimOpSolutions.Tasks.csproj.nuget.g.targets.
2018-01-27T02:58:25.4011791Z   Restore completed in 215.01 ms for d:\a\1\s\SimOpSolutions.Tasks\SimOpSolutions.Tasks.csproj.
2018-01-27T02:58:25.4034095Z   Restoring packages for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj...
2018-01-27T02:58:28.0818820Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Infrastructure\obj\SimOpSolutions.Infrastructure.csproj.nuget.g.props.
2018-01-27T02:58:28.0819787Z   Generating MSBuild file d:\a\1\s\SimOpSolutions.Infrastructure\obj\SimOpSolutions.Infrastructure.csproj.nuget.g.targets.
2018-01-27T02:58:28.0958022Z   Restore completed in 9.65 sec for d:\a\1\s\SimOpSolutions.Infrastructure\SimOpSolutions.Infrastructure.csproj.
2018-01-27T02:58:28.5158388Z   Restoring packages for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj...
2018-01-27T02:58:28.7015042Z   Installing YamlDotNet.Signed 4.2.1.
2018-01-27T02:58:28.7015669Z   Installing AWSSDK.Lambda 3.3.10.
2018-01-27T02:58:28.7016068Z   Installing Amazon.Lambda.Tools 2.0.1.
2018-01-27T02:59:49.1223089Z   Installing Microsoft.VisualStudio.Web.CodeGeneration.Contracts 2.0.1.
2018-01-27T02:59:49.1248772Z   Installing Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.1.
2018-01-27T02:59:56.4196984Z   Restore completed in 1.47 min for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj.
2018-01-27T02:59:56.8923026Z   Restore completed in 1.52 min for d:\a\1\s\SimOpSolutions.API\SimOpSolutions.API.csproj.
2018-01-27T02:59:56.9548214Z Beginning Serverless Deployment
2018-01-27T02:59:56.9549299Z Path to tool: C:\Program Files\dotnet\dotnet.exe
2018-01-27T02:59:56.9552784Z [command]"C:\Program Files\dotnet\dotnet.exe" lambda deploy-serverless --disable-interactive true --region us-east-1
2018-01-27T02:59:57.1481754Z No executable found matching command "dotnet-lambda"
2018-01-27T02:59:57.2033504Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2018-01-27T02:59:57.2414775Z ##[section]Finishing: Deploy to Lambda:  

当我更改项目路径以包含.csproj文件的完整路径时,部署开始工作。

问题是由于“Amazon.Lambda.Tools”NuGet包在“dotnet restore”(检查解决方案资源管理器-->依赖项-->NuGet)之后仍未下载。 要解决此问题,请在项目文件夹(即“cd.\YourProject”)内的数据包管理器控制台中运行“dotnet添加包Amazon.Lambda.Tools--version 2.1.1”


我必须在lambda项目的.csproj文件中添加对lambda工具的DotNetCliToolReference:

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

我遇到了类似的问题,下面是我如何解决的

将Amazon.Lambda.Tools安装到gloable,您可以在任何地方构建它

dotnet tool install --global Amazon.Lambda.Tools --version 3.1.1
更新至最新版本

dotnet tool update --global Amazon.Lambda.Tools
然后,您可以通过项目文件夹中的cmd行进行构建

dotnet-lambda package

我面临同样的问题,但上面的步骤对我不起作用。但是他们帮我解决了这个问题。我包括了我必须采取的步骤,以防有人需要与我相同的修复

首先,我必须将代理池更改为“托管VS2017”

对于管道中的第一个任务,我使用命令行任务安装了AmazonLambda工具。 我使用的脚本只是“dotnettool安装--全局Amazon.Lambda.Tools--版本3.2.3”。屏幕截图如下,除了添加脚本,我在该任务中没有其他更改

然后,我为AWS Lambda.NET Core添加了一个任务。下面是我填写的选项截图。仅包输出只是生成的zip的名称。lambda项目的路径必须是包含函数的.csproj文件

下面的屏幕截图是我为使其工作而添加的步骤。一旦我将这个构建排队,它就会在代理上安装lambda工具包,然后生成zip文件。希望这能帮助其他人。

如果您通过
dotnet lambda
命令手动部署会怎么样?看起来您使用的是托管VS2017代理,如果改用私有代理()会怎么样?不知道为什么默认情况下不设置此选项。。。只是浪费了几个小时既然这是被认可的答案,我希望我知道它的意思。也许举个例子可以更清楚地说明这一点。每次尝试这样做时,我都会遇到一个错误:
包Amazon.Lambda.Tools 3.2.3与netcoreapp2.1(.netCoreAppp,Version=v2.1)不兼容。包Amazon.Lambda.Tools 3.2.3支持:netcoreapp2.1(.NETCoreApp,Version=v2.1)/any
。由于某种原因,使用标准Lambda项目模板,该包似乎与我的项目不兼容<代码>包“Amazon.Lambda.Tools”与项目中的“all”框架不兼容