I changed the target framework from netcoreapp1.0 to netcoreapp2.0 in my .Net Core Lambda project.
When packaging the lambda I get an error executing the command dotnet lambda package -c Release -f netcoreapp2.0
:
Unknown error executing Lambda packaging: Could not find a part of the path
dotnet lambda package -c Release -f netcoreapp2.0
Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder 'C:\Source\\Project.Lambda\bin\Release\netcoreapp2.0\publish'
... publish: Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish: Restore completed in 32.96 ms for C:\Source\Project\Project.csproj.
... publish: Restore completed in 50.69 ms for C:\Source\Project.Lambda\Project.Lambda.csproj.
... publish: Restore completed in 80.61 ms for C:\Source\Project.Lambda\Project.Lambda.csproj.
... publish: Project -> C:\Source\Project\bin\Release\netcoreapp2.0\Project.dll
... publish: Project.Lambda -> C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\Project.Lambda.dll
... publish: Project.Lambda -> C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\publish\
Flattening platform specific dependencies
... flatten: runtime/unix/lib/_._
Unknown error executing Lambda packaging: Could not find a part of the path 'C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\publish\runtime\unix\lib\_._'.
at System.IO.Win32FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String destFileName)
at Amazon.Lambda.Tools.LambdaPackager.<>c__DisplayClass4_0.<FlattenRuntimeFolder>b__0(String sourceRelativePath)
at Amazon.Lambda.Tools.LambdaPackager.FlattenRuntimeFolder(IToolLogger logger, String publishLocation, JsonData depsJsonTargetNode)
at Amazon.Lambda.Tools.LambdaPackager.CreateApplicationBundle(LambdaToolsDefaults defaults, IToolLogger logger, String workingDirectory, String projectLocation, String configuration, String targetFramework, String& publishLocation, String& zipArchivePath)
at Amazon.Lambda.Tools.Commands.PackageCommand.<ExecuteAsync>b__22_0()
It seems the issue occurred because I was using an old version of Amazon.Lambda.Tools
:
<ItemGroup>
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="1.7.0" />
</ItemGroup>
Manually changing it to the latest version fixed it:
<ItemGroup>
<DotNetCliToolReference Include="Amazon.Lambda.Tools" Version="2.1.2" />
</ItemGroup>
The output now looks like this:
Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder 'C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\publish'
... publish: Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish: Restoring packages for C:\Source\Project\Project.csproj...
... publish: Restoring packages for C:\Source\Project.Lambda\Project.Lambda.csproj...
... publish: Restore completed in 32.96 ms for C:\Source\Project\Project.csproj.
... publish: Restore completed in 50.69 ms for C:\Source\Project.Lambda\Project.Lambda.csproj.
... publish: Project -> C:\Source\Project\bin\Release\netcoreapp2.0\Project.dll
... publish: Project.Lambda -> C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\linux-x64\Project.Lambda.dll
... publish: Project.Lambda -> C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\publish\
Zipping publish folder C:\Source\Project.Lambda\bin\Release\netcoreapp2.0\publish to C:\Source\Project.Lambda\lambda.zip
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.