Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AldeRoberge/2f982d6869045e99133358bffa951395 to your computer and use it in GitHub Desktop.
Save AldeRoberge/2f982d6869045e99133358bffa951395 to your computer and use it in GitHub Desktop.
Fixing a .NET Aspire Project Not Being Pushed to Docker

🧪 Debugging Missing Project in .NET Aspire Publish

While working with .NET Aspire, I encountered an issue where one of my projects (adg-banner-printer) wasn’t being included in the aspire publish process. Here's a breakdown of the troubleshooting steps and the root cause:

  1. Internal Program Class? I initially suspected the issue might be due to the Program class being marked as internal. That wasn’t the case.

  2. Private Main Method? Next, I checked whether the Main method being private might be the cause. Still no effect.

  3. Short-lived Console App? I considered whether the fact that the app was short-lived (exits immediately) might cause Aspire to skip it. That wasn’t the reason either.

  4. Missing DockerDefaultTargetOS? I noticed that the .csproj file didn’t include a DockerDefaultTargetOS property, and wondered if that was causing the silent failure. Adding it had no effect.

  5. Added Another Project (Still Ignored) To rule out project-specific issues, I created another simple console app named test. It too was ignored during publish.


✅ Root Cause

By default, .NET Aspire does not include console apps in the publish output. Unless the console app is explicitly referenced in your Aspire AppHost project and configured correctly, it will not be built or containerized — and Aspire provides no warning or error about this.


💡 Lesson Learned

If you're using console apps in your Aspire solution, make sure they are not console applications. Is this a bug, a feature? No clue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment