Skip to content

Commit d9c45e0

Browse files
committed
Fix issue aws/integrations-on-dotnet-aspire-for-aws#138 and build Amazon.Lambda.RuntimeSupport always as executable
Also update Amazon.Lambda.AspNetCoreServer.Hosting and Amazon.Lambda.TestTool to reference the latest version of Amazon.Lambda.RuntimeSupport
1 parent 9ea4482 commit d9c45e0

12 files changed

Lines changed: 53 additions & 21 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Lambda.RuntimeSupport",
5+
"Type": "Patch",
6+
"ChangelogMessages": [
7+
"Fixed missing entry point exception when used via Amazon.Lambda.TestTool for a class library based Lambda function that is also an executable with a dependency on Amazon.Lambda.RuntimeSupport."
8+
]
9+
},
10+
{
11+
"Name": "Amazon.Lambda.TestTool",
12+
"Type": "Patch",
13+
"ChangelogMessages": [
14+
"Update to include version 1.14.2 of Amazon.Lambda.RuntimeSupport"
15+
]
16+
},
17+
{
18+
"Name": "Amazon.Lambda.AspNetCoreServer.Hosting",
19+
"Type": "Patch",
20+
"ChangelogMessages": [
21+
"Update to include version 1.14.2 of Amazon.Lambda.RuntimeSupport"
22+
]
23+
}
24+
]
25+
}

LambdaRuntimeDockerfiles/Images/net10/amd64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0
3737
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
38-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-x64 -c Release -o /app/build
38+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-x64 -c Release -o /app/build
3939

4040

4141
FROM builder AS publish
42-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
42+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4343
RUN apt-get update && apt-get install -y dos2unix
4444
RUN dos2unix /app/publish/bootstrap.sh && \
4545
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \

LambdaRuntimeDockerfiles/Images/net10/arm64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net10.0
3737
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
38-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-arm64 -c Release -o /app/build
38+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 --runtime linux-arm64 -c Release -o /app/build
3939

4040

4141
FROM builder AS publish
42-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
42+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net10.0 -f net10.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4343
RUN apt-get update && apt-get install -y dos2unix
4444
RUN dos2unix /app/publish/bootstrap.sh && \
4545
mv /app/publish/bootstrap.sh /app/publish/bootstrap && \

LambdaRuntimeDockerfiles/Images/net8/amd64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRest
3636
COPY ["buildtools/", "Repo/buildtools/"]
3737
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net8.0
3838
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
39-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-x64 -c Release -o /app/build
39+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-x64 -c Release -o /app/build
4040

4141

4242
FROM builder AS publish
43-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 -f net8.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
43+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 -f net8.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4444
RUN apt-get update && apt-get install -y dos2unix
4545
RUN dos2unix /app/publish/bootstrap.net8.sh && \
4646
mv /app/publish/bootstrap.net8.sh /app/publish/bootstrap && \

LambdaRuntimeDockerfiles/Images/net8/arm64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ COPY ["Libraries/src/SnapshotRestore.Registry", "Repo/Libraries/src/SnapshotRest
3636
COPY ["buildtools/", "Repo/buildtools/"]
3737
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net8.0
3838
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
39-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-arm64 -c Release -o /app/build
39+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 --runtime linux-arm64 -c Release -o /app/build
4040

4141

4242
FROM builder AS publish
43-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 -f net8.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
43+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net8.0 -f net8.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4444
RUN apt-get update && apt-get install -y dos2unix
4545
RUN dos2unix /app/publish/bootstrap.net8.sh && \
4646
mv /app/publish/bootstrap.net8.sh /app/publish/bootstrap && \

LambdaRuntimeDockerfiles/Images/net9/amd64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0
3737
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
38-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-x64 -c Release -o /app/build
38+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-x64 -c Release -o /app/build
3939

4040

4141
FROM builder AS publish
42-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
42+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-x64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4343
RUN apt-get update && apt-get install -y dos2unix
4444
RUN dos2unix /app/publish/bootstrap.net8.sh && \
4545
mv /app/publish/bootstrap.net8.sh /app/publish/bootstrap && \

LambdaRuntimeDockerfiles/Images/net9/arm64/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ COPY ["Libraries/src/Amazon.Lambda.Core", "Repo/Libraries/src/Amazon.Lambda.Core
3535
COPY ["buildtools/", "Repo/buildtools/"]
3636
RUN dotnet restore "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj" /p:TargetFrameworks=net9.0
3737
WORKDIR "Repo/Libraries/src/Amazon.Lambda.RuntimeSupport"
38-
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-arm64 -c Release -o /app/build
38+
RUN dotnet build "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 --runtime linux-arm64 -c Release -o /app/build
3939

4040

4141
FROM builder AS publish
42-
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:ExecutableOutputType=true /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
42+
RUN dotnet publish "Amazon.Lambda.RuntimeSupport.csproj" /p:GenerateDocumentationFile=false /p:TargetFrameworks=net9.0 -f net9.0 --runtime linux-arm64 --self-contained false -p:PublishReadyToRun=true -c Release -o /app/publish
4343
RUN apt-get update && apt-get install -y dos2unix
4444
RUN dos2unix /app/publish/bootstrap.net8.sh && \
4545
mv /app/publish/bootstrap.net8.sh /app/publish/bootstrap && \

Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/Amazon.Lambda.AspNetCoreServer.Hosting.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<Version>1.9.0</Version>
10+
<Version>1.9.1111</Version>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<AssemblyName>Amazon.Lambda.AspNetCoreServer.Hosting</AssemblyName>
1313
<PackageId>Amazon.Lambda.AspNetCoreServer.Hosting</PackageId>

Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net9.0;net10.0</TargetFrameworks>
7-
<Version>1.14.1</Version>
7+
<Version>1.14.1112</Version>
88
<Description>Provides a bootstrap and Lambda Runtime API Client to help you to develop custom .NET Core Lambda Runtimes.</Description>
99
<AssemblyTitle>Amazon.Lambda.RuntimeSupport</AssemblyTitle>
1010
<AssemblyName>Amazon.Lambda.RuntimeSupport</AssemblyName>
@@ -22,11 +22,21 @@
2222
ready to make a major version release of our libraries.
2323
-->
2424
<CheckEolTargetFramework>false</CheckEolTargetFramework>
25+
26+
<!--
27+
Build as a executable which is required for the managed runtime and when used via Amazon.Lambda.TestTool for
28+
testing class library based Lambda functions. Letting it be built as a executable even for the executable
29+
programming model where it is used as a library. This is because it is possible a user might have a
30+
executable project that also has some class library like style functions. In that scenario Amazon.Lambda.RuntimeSupport
31+
would come from project instead of Amazon.Lambda.TestTool when testing. If we didn't compile as a executable
32+
the user gets a missing entry point exception.
33+
https://github.com/aws/integrations-on-dotnet-aspire-for-aws/issues/138
34+
-->
35+
<OutputType>Exe</OutputType>
2536
</PropertyGroup>
2637

27-
<PropertyGroup Condition=" '$(ExecutableOutputType)'=='true' ">
38+
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
2839
<OutputType>Exe</OutputType>
29-
<DefineConstants>$(DefineConstants);ExecutableOutputType</DefineConstants>
3040
</PropertyGroup>
3141

3242
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net10.0'">

Libraries/src/Amazon.Lambda.RuntimeSupport/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class Program
2828
// .NET 10 considers adding RequiresUnreferencedCode on the entry point a warning. Our situation is different then the normal use case in that the only time
2929
// the Main exists in the Lambda class library mode which will never be used for Native AOT.
3030
#pragma warning disable IL2123
31-
#if ExecutableOutputType
3231
#if NET8_0_OR_GREATER
3332
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(
3433
"The Main entry point is used in the managed runtime which loads Lambda functions as a class library. " +
@@ -50,7 +49,6 @@ private static async Task Main(string[] args)
5049
RuntimeSupportInitializer runtimeSupportInitializer = new RuntimeSupportInitializer(handler, lambdaBootstrapOptions);
5150
await runtimeSupportInitializer.RunLambdaBootstrap();
5251
}
53-
#endif
5452
#pragma warning restore IL2123
5553

5654
#if NET8_0_OR_GREATER

0 commit comments

Comments
 (0)