4

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.

14
  • When you deploy your app manually to EB, does it work as expected? meaning, it is only CP issue? Commented Jul 2, 2020 at 23:54
  • Yep - works fine when I deploy via VS2019 AWS explorer. That’s the frustrating thing. Commented Jul 3, 2020 at 5:12
  • Can you inspect the app version that CP produces? CP will will produce an artifact in its bucket. The artifact file will have some strange name and no extensions. You can download it, add zip extensions and check if it has all the files needed. Maybe build stage did not create some needed files. Commented Jul 3, 2020 at 5:19
  • Yes I checked that - see attached image - everything looks OK, but perhaps you know of something that is missing? Commented Jul 3, 2020 at 7:04
  • 1
    First thing I noticed is 'base-directory' indentation is incorrect. Commented Jul 3, 2020 at 7:18

4 Answers 4

4

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.

Sign up to request clarification or add additional context in comments.

5 Comments

Is there a way to fix this avoiding to change the dll name?
I don't think it's a good way to do it, but I'm doing it the following way. You can avoid the error by creating a class library with the same class name as the solution name and generating an empty DLL file.
How can it work if it is not the application entry point? BTW I've posted a specific question here. One of the comments contains a link to the post I opened in the AWS forum as well
This DLL just exists in an application dependency, which is a workaround. I agree with you, and I think this is a problem that needs to be fixed.
It means it is not looking for an entry point as I thought but a random dll with the solution name. Thanks
1

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.

Comments

1

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

base-directory: 'build_output'

Should be

  base-directory: 'build_output'

Comments

1

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

1 Comment

If you have some dot (.) in your Assembly name you will have this problem to deploy in elasticbeanstalk by eb command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.