aws-extensions-for-dotnet-cli icon indicating copy to clipboard operation
aws-extensions-for-dotnet-cli copied to clipboard

Fixed an ElasticBeanstalk deployment issue for Linux platform where Procfile was sometimes being generated with incorrect entrypoint when multiple runtimeconfig.json files were present.

Open ashishdhingra opened this issue 10 months ago • 0 comments

Issue #, if available: #285

Description of changes: Fixed an ElasticBeanstalk deployment issue for Linux platform where Procfile was sometimes being generated with incorrect entrypoint when multiple runtimeconfig.json files were present.

The existing logic to determine the project file .csproj uses Utilitites.FindProjectFileInDirectory(). It has explicit check here to ensure that we get only one project file; else it returns null. So in case there are multiple project files, it would probably throw NullReferenceException in subsequent logic. We are using this assumption that we only have one project file for deployment at root of working directory, to get the assembly name (via msbuild).

Also note that we also invoke BaseCommand.EnsureInProjectDirectory(). This throws generic exception $"No .NET project found in directory {projectLocation} to build." in case where more than one project file if found in working directory, which might be incorrect or misleading.

NOTE: Refer Using a Procfile to configure your .NET Core on Linux Elastic Beanstalk environment where it shows below example to configure 2 web applications.

web: dotnet ./dotnet-core-app1/dotnetcoreapp1.dll
web2: dotnet ./dotnet-core-app2/dotnetcoreapp2.dll

The PR supports one web application as of now to conform to existing logic. CC @normj


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

ashishdhingra avatar Feb 19 '25 22:02 ashishdhingra