title: Referenced class library projects are not found when using AWS cdk to deploying a .NET6 lambda function
body: <p>I am trying to deploy a .NET6 based AWS Lambda function - &quot;ABC.DynamoDBConnectLambda&quot; using AWS CDK in Typescript. &quot;ABC.DynamoDBConnectLambda&quot; references two other custom class libraries - &quot;ABC.Data&quot; and &quot;ABC.Services&quot; which all live in the same &quot;src&quot; folder.</p>
  <p>After running &quot;cdk synth&quot;, I am getting the following error messages:</p>
  <pre><code> Skipping project &quot;/ABC.Data/ABC.Data.csproj&quot; because it was not found.
   Skipping project &quot;/ABC.Services/ABC.Services.csproj&quot; because it was not found.
   Restored /asset-input/ABC.DynamoDBConnectLambda.csproj (in 26.49 sec).
      /var/lang/bin/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(2065,5): warning : The referenced project '../ABC.Data/ABC.Data.csproj' does not exist. [/asset-input/ABC.Data/ABC.Data.csproj]
  /var/lang/bin/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(2065,5): warning : The referenced project '..//ABC.Services/ABC.Services.csproj' does not exist. [/asset-input/ABC.Services.csproj]
  /var/lang/bin/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(2065,5): warning : The referenced project '../Trustees.SFTPServices.Data/Trustees.SFTPServices.Data.csproj' does not exist.
  </code></pre>
  <p>Any help or suggestions would be very appreciated. Thanks in advance.</p>
  <p>I did some research and it seems to related to the command for publishing project, below is the dotnet cli that I run:</p>
  <pre><code>dotnet publish -c Release -r linux-x64 --self-contained -o /asset-output
  </code></pre>
  <p>Below is the complete cdk code I have:</p>
  <pre><code>const dynamoDbConnectLambda = new lambda.Function(this, 'dynamoDBEventHandler', {
    runtime: lambda.Runtime.DOTNET_6,
    timeout: cdk.Duration.seconds(120),
    handler: 'bootstrap',
    code: lambda.AssetCode.fromAsset(path.join(__dirname,'../../src/Lambda.DynamoDBConnect'), {
      bundling: {
        image: lambda.Runtime.DOTNET_6.bundlingImage,
        command: [
          'bash', '-c',
          'export DOTNET_CLI_HOME=/tmp/DOTNET_CLI_Home &amp;&amp; dotnet publish -c Release -r linux-x64 --self-contained -o /asset-output'
        ]
      }
    })
  });
  </code></pre>
  <p>Below is the csproject file for lambda project - &quot;ABC.DynamoDBConnect&quot;</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
    &lt;PropertyGroup&gt;
      &lt;OutputType&gt;Exe&lt;/OutputType&gt;
      &lt;TargetFramework&gt;net6.0&lt;/TargetFramework&gt;
      &lt;LangVersion&gt;latest&lt;/LangVersion&gt;
      &lt;AWSProjectType&gt;Lambda&lt;/AWSProjectType&gt;
      &lt;AssemblyName&gt;bootstrap&lt;/AssemblyName&gt;
      &lt;!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. --&gt;
      &lt;CopyLocalLockFileAssemblies&gt;true&lt;/CopyLocalLockFileAssemblies&gt;
      &lt;PublishTrimmed&gt;true&lt;/PublishTrimmed&gt;
      &lt;PublishReadyToRun&gt;true&lt;/PublishReadyToRun&gt;
    &lt;/PropertyGroup&gt;
    &lt;!-- 
    When publishing Lambda functions for ARM64 to the provided.al2 runtime a newer version of libicu needs to be included
    in the deployment bundle because .NET requires a newer version of libicu then is preinstalled with Amazon Linux 2.
    --&gt;
    &lt;ItemGroup Condition=&quot;'$(RuntimeIdentifier)' == 'linux-arm64'&quot;&gt;
      &lt;RuntimeHostConfigurationOption Include=&quot;System.Globalization.AppLocalIcu&quot; Value=&quot;68.2.0.9&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.ICU.ICU4C.Runtime&quot; Version=&quot;68.2.0.9&quot; /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Amazon.Lambda.RuntimeSupport&quot; Version=&quot;1.7.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Amazon.Lambda.Core&quot; Version=&quot;2.1.0&quot; /&gt;
      &lt;PackageReference Include=&quot;Amazon.Lambda.S3Events&quot; Version=&quot;2.0.1&quot; /&gt;
      &lt;PackageReference Include=&quot;Amazon.Lambda.Serialization.SystemTextJson&quot; Version=&quot;2.3.0&quot; /&gt;
      &lt;PackageReference Include=&quot;AWSSDK.Core&quot; Version=&quot;3.7.10.2&quot; /&gt;
      &lt;PackageReference Include=&quot;AWSSDK.DynamoDBv2&quot; Version=&quot;3.7.3.17&quot; /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;ProjectReference Include=&quot;..\ABC.Service.csproj&quot; /&gt;
      &lt;ProjectReference Include=&quot;..\ABC.Data.csproj&quot; /&gt;
  &lt;/Project&gt;
  </code></pre>