Publishing ASP.NET Core: An error occurred while starting the application

Have you seen this error?
An error occurred while starting the application.
.NET Core <version> | Microsoft.AspNetCore.Hosting <version> | Microsoft Windows <version> | Need help?

It looks like this in your browser:

Besides that one hint, that the error is while starting, it’s not very descriptive, right?

Althouth there many things that could go wrong and the proper way is to actually troubleshoot the error, I end up googling about this for over an hour! In my search I found numerous articles but it turned out that for me the solution was simple!

I forgot to configure the release output path for swagger :/

Probably you already know how to do this, but in case you don’t remember…:
Right click your project, then click Properties, then click theBuild tab and at the Output section check the XML documentation file:

And if configuring swagger wasn’t the solution, you can either check one of the links below, or just troubleshoot your app.