So I just hit a wall in a project I am writing. It’s an AWS Lambda function, in .NET Core 2.1, that is using DataAbstract to connect to the database. I got it to a point where everything was working perfectly in my dev environment, but when I tried to publish the serverless app to AWS, the build process failed with this error:
.. invoking 'dotnet publish', working folder ... ... Disabling compilation context to reduce package size. If compilation context is needed pass in the "/p:PreserveCompilationContext=false" switch. ... publish: Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core ... publish: Copyright (C) Microsoft Corporation. All rights reserved. ... ... publish: C:\Program Files\dotnet\sdk\2.1.602\Microsoft.Common.CurrentVersion.targets(3164,5): error MSB4062: The "Microsoft.Build.Tasks.LC" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. Failed to create application package
This is related to this MSBuild issue which basically means that we can’t build .NET Core projects that require a licenses.licx file (as RO does), using dotnet.exe.
I know I can use MSBuild and MSDeploy as suggested in the issue’s description, but trying to replicate manually everything the AWS Lambda Tools do, is far more work for me than maybe other options (such as creating an Http API method to access the data and call that from the Lambda function).
I’m not sure there is anything than can be done in this case, so I’m just reporting this problem here, as it is not possible right now to build any .NET Core 2.1 project that uses RO/DA using the MSBuild version that dotnet.exe uses. This problem might be solved when .NET Core 3.0 comes out later this year.
In the meantime, I’ll look into HttpApi and remove the RO Client libraries from the lambda functions, .