Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# .NET Core Lambda函数无法生成部署包。无法找到任何兼容的框架_C#_.net_Amazon Web Services_.net Core_Aws Lambda - Fatal编程技术网

C# .NET Core Lambda函数无法生成部署包。无法找到任何兼容的框架

C# .NET Core Lambda函数无法生成部署包。无法找到任何兼容的框架,c#,.net,amazon-web-services,.net-core,aws-lambda,C#,.net,Amazon Web Services,.net Core,Aws Lambda,我有一个.NET核心Lambda函数,它无法使用dotnet Lambda实用程序为AWS Lambda构建部署包。这个函数以前是.NET Core 1.0,我不得不将它升级到.NET Core 3.1,因为1.0不再受支持。使用AWS Toolkit for Visual Studio部署到AWS效果良好,并且正确地将.NET Core 3.1作为目标。我已经将tools/defaults.json更新为目标Core3.1,并将项目属性更新为目标Core3.1 但是,对于这个练习,我需要单独构

我有一个.NET核心Lambda函数,它无法使用dotnet Lambda实用程序为AWS Lambda构建部署包。这个函数以前是.NET Core 1.0,我不得不将它升级到.NET Core 3.1,因为1.0不再受支持。使用AWS Toolkit for Visual Studio部署到AWS效果良好,并且正确地将.NET Core 3.1作为目标。我已经将tools/defaults.json更新为目标Core3.1,并将项目属性更新为目标Core3.1

但是,对于这个练习,我需要单独构建一个部署zip来上传它,而实用程序无法构建它。它好像还在某个地方引用了.NETCore1.0

命令:

$ dotnet lambda package -c Release -o erececipt_lambda_trigger.zip -f netcoreapp3.1
错误:

不可能找到任何兼容的框架 版本框架“Microsoft.NETCore.App”的版本“1.0.0”不可用 找到了

  • 发现了以下框架: 2.1.16位于[C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.2.0位于[C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.2位于[C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
您可以通过安装指定的框架来解决此问题 和/或SDK

指定的框架可在以下位置找到:

我遵循了链接,当然它已经死了,但我找到了一种使用PowerShell下载和安装.NET Core 1.0的方法:

PS C:\> .\dotnet-install.ps1 -Channel 1.0
dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/1.1.11/dotnet-sdk-1.1.11-win-x64.zip
dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Sdk/1.1.11/dotnet-sdk-1.1.11-win-x64.zip
dotnet-install: Downloading legacy link: https://dotnetcli.azureedge.net/dotnet/Sdk/1.1.11/dotnet-dev-win-x64.1.1.11.zip
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/1.1.11/dotnet-dev-win-x64.1.1.11.zip
dotnet-install: Adding to current process PATH: "C:\Users\JMatson\AppData\Local\Microsoft\dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
dotnet-install: Installation finished
但是,lambda实用程序仍然失败,并出现相同的错误。我能做什么?我的.csproj文件如下所示:

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

  <PropertyGroup Label="Globals">
    <SccProjectName></SccProjectName>
    <SccProvider></SccProvider>
    <SccAuxPath></SccAuxPath>
    <SccLocalPath></SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
    <FileVersion>2.0.0.0</FileVersion>
    <Version>2.0.0</Version>
    <Description>Lambda function for converting receipt control files into HTML email messages.</Description>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
    <PackageReference Include="Amazon.Lambda.Serialization.Json" Version="1.7.0" />
    <PackageReference Include="Amazon.Lambda.S3Events" Version="1.1.0" />
    <PackageReference Include="AWSSDK.S3" Version="3.3.111.21" />
    <PackageReference Include="AWSSDK.SimpleEmail" Version="3.3.101.174" />
    <PackageReference Include="AWSSDK.SimpleSystemsManagement" Version="3.3.126.8" />
    <PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.1" />
    <PackageReference Include="SqlKata" Version="2.2.0" />
    <PackageReference Include="SqlKata.Execution" Version="2.2.0" />
    <PackageReference Include="system.data.common" Version="4.3.0" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
    <PackageReference Include="Microsoft.NETCore.Targets" Version="3.0.0" PrivateAssets="all" />
  </ItemGroup>

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

netcoreapp3.1
2.0.0.0
2.0.0.0
2.0.0
Lambda函数,用于将收据控制文件转换为HTML电子邮件消息。
删除

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


允许lambda包工具工作,因为.csproj文件中的此条目是lambda工具早期版本的保留(可能是从该项目是.NET Core 1.0时开始)。

您的
.csproj
文件看起来不正确,
DotNetCliToolReference
似乎无效,根据这就是问题所在。删除该引用可以生成项目。你应该回答这个问题Pavel?我不认为这是一个答案,它只是指向aws lambda工具迁移的链接。我已经发布了确切/具体的答案。