1

I'm trying to use the Amazon Elastic Beanstalk Tools for .NET Core applications (4.2.2) to publish a net6.0 app to AWS EB (windows). At the time of writing I need to include the net6.0 runtime since net6.0 is not supported on EB yet. I can successfully publish my app to AWS using the AWS Toolkit for Visual Studio. The toolkit calls dotnet publish with the following parameters:

Executing: dotnet publish "[my project path]" --output "[my project path]\bin\Release\net6.0\publish" --configuration "Release" --framework "net6.0"  --runtime win-x64 --self-contained true

The toolkit creates this config file (aws-beanstalk-tools-defaults.json) following a successful publish:

{
"additional-options" : "",
"application"        : "myApp",
"app-path"           : "/",
"configuration"      : "Release",
"enable-xray"        : false,
"enhanced-health-type" : "enhanced",
"environment"          : "myApp-test",
"framework"            : "net6.0",
"iis-website"          : "Default Web Site",
"region"               : "eu-west-1",
"self-contained"       : true,
"runtime"              : "win-x64"

}

However when I try to use the command line utility with the command:

dotnet eb deploy-environment -cfg myConfFile.json

the self-contained and runtime parameters are not passed to the dotnet deploy call resulting in this call:

dotnet publish "my project path]" --output "my project path]\bin\Release\net6.0\publish" --configuration "Release" --framework "net6.0"

I have tried passing the parameters without using the config file as

dotnet eb deploy-environment --profile XXX -c Release -env myApp-test -po --runtime "win-x64"

only to get trigger this exception:

System.InvalidOperationException: Required argument missing for option: --runtime

Is there anyway to use this utility to publish a net6.0 app using self-contained bundled to a windows based EB instance ?

1 Answers1

1

This is a bug/limitation in version 4.2.2 of AWS Beanstalk Tools for .NET Core. The utility only reads this parameter for non windows environments. There is however a workaround. It is possible to pass the win-x64 parameter using the --publish-options parameter like this:

dotnet eb deploy-environment -c Release -cfg myConfFile --publish-options  "--runtime win-x64" "--self-contained true"

This will actually result in a warning:

warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used.

But the self contained image will still get published. You can actually skip the --self-contained parameter. The result will be the same.