Home > Enterprise >  Deploy .Net 6 app with multiple projects to Linux Elastic Beanstalk Server from mac development mach
Deploy .Net 6 app with multiple projects to Linux Elastic Beanstalk Server from mac development mach

Time:02-21

I'm trying to Deploy .Net 6 app with multiple projects to Linux Elastic Beanstalk Server from mac development machine.

The project has one Asp.Net app (Vepo.Web) and 5 helper projects for the app layers. the "Vepo" project is just a placeholder I made because the internet told me there is a bug when you name your dll different to your solution and the solution is "Vepo.sln".

I've run this command:

dotnet publish -r linux-x64  --self-contained true --output build

I have to upload one file to Elastic Beanstalk:

enter image description here

I have 6 projects in my .net core app. So the files created by the publish look like this:

enter image description here

I have compressed build to a zip file and uploaded it here:

enter image description here

But in the logs I can see this error:

An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: there is no .runtimeconfig.json file for your single application. Please provide a valid application

Which makes no sense because you can clearly see several runtimeconfig.json files in the screenshot.

And if I cd to build and run dotnet Vepo.Web.dll the app runs successfully.

Why I do see the error "there is no .runtimeconfig.json file" when there clearly is one?

Fffffffffff I have tried all sorts of combinations all day and night >:(

Is it because I compress it to a zip by right clicking it and clicking compress? I'm on Mac M1

These are my projects. "Vepo" is just a placeholder I added to try to fix a bug where people said it expects the dll name to match the solution name.

enter image description here

The error has become:

2022/02/19 12:14:02.464293 [ERROR] An error occurred during execution of command [app-deploy] - [CheckProcfileForDotNetCoreApplication]. Stop running the command. Error: error stat /var/app/staging/build/Vepo.DataContext: no such file or directory with file /var/app/staging/build/Vepo.DataContext

2022/02/19 12:14:02.464298 [INFO] Executing cleanup logic 2022/02/19 12:14:02.464384 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment found a self-contained .NET Core application in your source bundle.","timestamp":1645272842,"severity":"INFO"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1645272842,"severity":"ERROR"}]}]}

Could it be because my app has a database which I haven't deployed?

CodePudding user response:

It seems to have worked when I cd into my asp.net core web app (Vepo.Web), then run dotnet publish -r linux-x64 --self-contained false --output build, then go to "Vepo.Web/build" in finder. Then select all files > right-click > compress (do not compress the parent folder!). That creates "archive.zip". Then upload "archive.zip" in the Elastic Beanstalk Console.

BTW I needed to add this to some of my .csproj files:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <SelfContained>False</SelfContained>
  </PropertyGroup>
...

So only publish the asp.net core web app, not the whole solution or multiple projects, and it will reference the other projects automatically.

Now I need to deploy my database as in the EB logs I have:

An error occurred using the connection to database 'vepo_dev_db' on server ''.

But for the scope of this question, I believe I have resolved it.

  • Related