Skip to content

PQA005 — Executable project already has Main entry point

The project is an executable and already declares Main, so the generated entry point is skipped.

An adapter built as a console application normally gets its Main from the generator: it builds the host, seeds the adapter's diagnostics identity from the registration document, and starts the adapter. When the project already contains a Main, the generator leaves it alone and emits nothing.

Why this is reported

The hand-written entry point is now the whole startup path. Everything the generated Main would have done — host construction, service registration, adapter identity — is the adapter's own responsibility from here on, and nothing else will report that it is missing.

The collision is often unintentional. A top-level statements file, a leftover Program.cs from a project template, or a sample copied into the adapter all declare a Main without looking like one.

How to fix it

Delete the hand-written entry point when it exists only because a template created it. The generated one is the supported startup path.

Keep it only deliberately, when the adapter genuinely needs a custom host — and then wire the adapter startup by hand and note the reason in the adapter's own documentation, so the next reader knows the generated path was declined rather than lost.

If you disagree with a report

Do not suppress it. A wrong report is a bug in the check — report it with the code that triggered it.