我已经成功部署了一层包,现在正试图将我的函数与应用程序发布。
存储的S3桶中的Artifacts文件:
<?xml version="1.0"?>
-<StoreArtifacts>
<Package Version="2.0.0" Id="Amazon.Lambda.Core"/>
<Package Version="1.2.0" Id="Amazon.Lambda.Core"/>
<Package Version="2.1.0" Id="Amazon.Lambda.Serialization.SystemTextJson"/>
<Package Version="1.8.0" Id="DocX"/>
<Package Version="1.18.0" Id="Azure.Core"/>
<Package Version="1.0.0" Id="Microsoft.Bcl.AsyncInterfaces"/>
<Package Version="4.6.0" Id="Microsoft.Graph"/>
<Package Version="2.0.5" Id="Microsoft.Graph.Core"/>
<Package Version="4.35.1" Id="Microsoft.Identity.Client"/>
<Package Version="6.12.2" Id="Microsoft.IdentityModel.JsonWebTokens"/>
<Package Version="6.12.2" Id="Microsoft.IdentityModel.Logging"/>
<Package Version="6.12.2" Id="Microsoft.IdentityModel.Protocols"/>
<Package Version="6.12.2" Id="Microsoft.IdentityModel.Protocols.OpenIdConnect"/>
<Package Version="6.12.2" Id="Microsoft.IdentityModel.Tokens"/>
<Package Version="6.12.2" Id="System.IdentityModel.Tokens.Jwt"/>
<Package Version="1.0.2" Id="System.Memory.Data"/>
<Package Version="13.0.1" Id="Newtonsoft.Json"/>
</StoreArtifacts>
然后尝试使用:
部署函数dotnet lambda deploy-function DemoFunction --function-layers arn:aws:lambda:us-east-2:687758306845:layer:DemoLayer:1
我得到多个错误
... publish: C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsFunction.cs(4,7): error CS0246: The type or namespace name 'Xceed' could not be found (are you missing a using directive or an assembly reference?) [C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]
... publish: C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsFunction.cs(5,7): error CS0246: The type or namespace name 'Xceed' could not be found (are you missing a using directive or an assembly reference?) [C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]
... publish: C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsFunction.cs(8,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]
... publish: C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsFunction.cs(10,17): error CS0234: The type or namespace name 'Identity' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]
... publish: C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsFunction.cs(11,17): error CS0234: The type or namespace name 'Graph' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]
我怎样才能使这个部署工作?失败的行位于顶部的导入处:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xceed.Document.NET;
using Xceed.Words.NET;
using Amazon.Lambda.Core;
using System.IO;
using Newtonsoft.Json.Linq;
using System.Text.RegularExpressions;
using Microsoft.Identity.Client;
using Microsoft.Graph;
using System.Net.Http.Headers;
您确定您的测试以及您的项目引用了所需的包吗?
根据你的错误信息,看起来DemoTests.csproj
缺少引用:
[C:UsersUserXsourcereposDemoTestsDemoTestssrcDemoTestsDemoTests.csproj]