【问题标题】:AWS Lambda using Visual Studio code使用 Visual Studio 代码的 AWS Lambda
【发布时间】:2019-04-18 03:12:45
【问题描述】:

我只是想使用 Visual Studio Code 来处理 AWS lambda 函数并按照this 链接中的步骤操作

在我运行 dotnet lambda 时执行所有步骤后,我不断收到以下错误。我的所有软件包都是最新的,而且我正在使用 core 2.1

PS C:\Lambda> dotnet lambda --help
No executable found matching command "dotnet-lambda"

我的项目文件:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <AWSProjectType>Lambda</AWSProjectType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Amazon.Lambda.Core" Version="1.0.0" />
    <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.4.0" />
  </ItemGroup>

</Project>

这是我由模板创建的项目结构

VS 代码版本

另外,当我运行 dotnet --help 时,我什至在 sdk 中都看不到 dotnet lambda

dotnet --help
.NET Command Line Tools (2.1.403)
Usage: dotnet [runtime-options] [path-to-application] [arguments]

Execute a .NET Core application.

runtime-options:
  --additionalprobingpath <path>     Path containing probing policy and assemblies to probe for.
  --additional-deps <path>           Path to additional deps.json file.
  --fx-version <version>             Version of the installed Shared Framework to use to run the application.
  --roll-forward-on-no-candidate-fx  Roll forward on no candidate shared framework is enabled.

path-to-application:
  The path to an application .dll file to execute.

Usage: dotnet [sdk-options] [command] [command-options] [arguments]

Execute a .NET Core SDK command.

sdk-options:
  -d|--diagnostics  Enable diagnostic output.
  -h|--help         Show command line help.
  --info            Display .NET Core information.
  --list-runtimes   Display the installed runtimes.
  --list-sdks       Display the installed SDKs.
  --version         Display .NET Core SDK version in use.

SDK commands:
  add               Add a package or reference to a .NET project.
  build             Build a .NET project.
  build-server      Interact with servers started by a build.
  clean             Clean build outputs of a .NET project.
  help              Show command line help.
  list              List project references of a .NET project.
  migrate           Migrate a project.json project to an MSBuild project.
  msbuild           Run Microsoft Build Engine (MSBuild) commands.
  new               Create a new .NET project or file.
  nuget             Provides additional NuGet commands.
  pack              Create a NuGet package.
  publish           Publish a .NET project for deployment.
  remove            Remove a package or reference from a .NET project.
  restore           Restore dependencies specified in a .NET project.
  run               Build and run a .NET project output.
  sln               Modify Visual Studio solution files.
  store             Store the specified assemblies in the runtime package store.
  test              Run unit tests using the test runner specified in a .NET project.
  tool              Install or manage tools that extend the .NET experience.
  vstest            Run Microsoft Test Engine (VSTest) commands.

Additional commands from bundled tools:
  dev-certs         Create and manage development certificates.
  ef                Entity Framework Core command-line tools.
  sql-cache         SQL Server cache command-line tools.
  user-secrets      Manage development user secrets.
  watch             Start a file watcher that runs a command when files change.

Run 'dotnet [command] --help' for more information on a command.

有人可以指导我吗

谢谢

【问题讨论】:

  • 安装 Amazon Lambda 工具 dotnet tool install -g Amazon.Lambda.Tools
  • dotnet tool install -g Amazon.Lambda.Tools Tool 'amazon.lambda.tools' 已安装。
  • 仍然没有 dotnet lambda?检查包含工具的文件夹是否在您的 $PATH 中。
  • 是的还是一样我在开始这个项目之前已经安装了 lambda 工具
  • 这里有同样的问题,你能以某种方式解决这个问题吗?谢谢。

标签: visual-studio-code .net-core aws-lambda


【解决方案1】:

我遇到了类似的问题,

以下是我的解决方法

dotnet tool install --global Amazon.Lambda.Tools --version 3.1.2

【讨论】:

    【解决方案2】:

    运行后重启 VS Code

    dotnet tool install -g Amazon.Lambda.Tools
    

    为我工作

    【讨论】:

    • 这不是this answer建议的吗?
    • 我觉得关于重新启动 VS Code 的部分是相关的,因为如果没有该步骤,解决方案将无法工作,但是由于声誉要求,我无法发表评论。
    猜你喜欢
    • 2019-09-04
    • 2019-07-12
    • 2020-10-04
    • 2017-06-17
    • 2018-06-02
    • 1970-01-01
    • 2012-09-24
    • 1970-01-01
    • 2022-10-19
    相关资源
    最近更新 更多