CodePipeline ElasticBeanstalk [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]

Viewed 3829

I've built a Code Pipeline (Source > Build > Deploy) and it's failing on the deploy step.

It's a Net Core 3.1 Api project.

I check the elastic beanstalk logs and I see:

2020/07/02 14:14:00.600060 [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: error stat /var/app/staging/MyApi/MyApi.dll: no such file or directory with file /var/app/staging/MyApi/MyApi.dll

As far as I know I have no control over /var/app/staging/ and this is built in AWS stuff?

The build step is working so I am unsure on this error.

My buildspec.yml is:

version: 0.2
phases:
  build:
    commands:      
      - dotnet publish -c release -o ./build_output ./MyApi/MyApi.csproj
artifacts:
  files:
    - '**/*'
base-directory: 'build_output'

This is the "zipfile/build_output" folder:

Code Pipeline Build Artifacts

This is the zip file root folder:

enter image description here

These are the files in the build artifacts zip file that pipeline is using. The error says it cannot find MyAppName.dll (renamed to MyApi in the pic). It's there so I wonder why the problem.

Perhaps it doesnt like the folder structure in the zip file - see pic.

4 Answers

I had the same problem.

In my case, if the solution name and project name were different, I got the same error when I deployed the code from Visual Studio to Beanstalk, but when I added a project with the same name as the solution name and built it, I didn't get an error. I suspect that there will be behavior during deployment that assumes the .dll file has the same name as the solution name.

Warning: This is a workaround, not a solution!

On the project that's failing to deploy, change the "Assembly name" in Project Properties / Application tab, to the name of the DLL it's missing (typically the solution name or the first period-separated part of the namespace).

i.e. "SLNNAME"

Then, redeploy your beanstalk app and it should work.

As Marcin correctly noticed, the indentation was incorrect for the "base-directory"

base-directory: 'build_output'

Should be

  base-directory: 'build_output'

As others have noted, it is looking for only the first part of your project name .dll. In my case, my project and Assembly name were both UC.Web which yielded the error during deployment:

Error: error stat /var/app/staging/UC.dll: no such file or directory with file /var/app/staging/UC.dll

My solution that worked was I renamed my Assembly name from UC.Web to simply UC and it deployed successfully. While a solution for everyone, it is a workaround for the time being until Amazon fixes this.

enter image description here

Related