I am trying to build a CD pipeline using the GitHub Actions and AWS Beanstalk (Linux) for my ASP.NET Core 3.1 app. I have configured the YML file as follows:
- name: dotnet Build
run: dotnet build src/SLNNAME.sln -c Release --no-restore
- name: dotnet Publish
run: |
dotnet publish src/SLNNAME.Server/SLNAME.Server.Web/SLNNAME.Server.Web.csproj -c Release -o staging_SLNNAME_server -r linux-x64
- name: Build deployment package
run: zip -r staging-server-deploy.zip staging_SLNNAME_server
..
- name: Deploy to AWS Beanstalk
uses: einaregilsson/beanstalk-deploy@v10
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
region: ${{ secrets.AWS_REGION }}
application_name: SLNNAME-staging-app-web
environment_name: SLNNAME-staging-server
version_label: "staging-app-web-${{ steps.format-time.outputs.replaced }}"
deployment_package: staging-server-deploy.zip
But an error occurs during the deployment to AWS. In particular, looking at the Beanstalk logs I can read the following error:
[ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: error stat /var/app/staging/staging_SLNNAME_server/SLNNAME.dll: no such file or directory with file /var/app/staging/staging_SLNNAME_server/SLNNAME.dll
Basically, I think it is looking for a DLL with the solution name instead of the project name - SLNName.Server.Web. I wonder yet where it is picking up the solution name, since it is not part of the zip file.
I gave a try with the --self-contained flag as well, but the error is exactly the same.
I have this error even if I try to publish the solution using the AWS toolking Visual Studio extension.
The only way I have found to fix this is to change the project output DLL name to match the solution one, but it doesn't make any sense to me - I might have more problems in future.
Thanks
web: dotnet staging_<placeholder>_server/SLNNAME.Server.Web.dll, but AWS doesn't read it for some reason