Skip to content

Commit 6a0e908

Browse files
CopilotBillWagner
andcommitted
Fix StartupObject documentation to clarify when it's needed and qualification requirements
Co-authored-by: BillWagner <[email protected]>
1 parent d586919 commit 6a0e908

File tree

1 file changed

+2
-2
lines changed
  • docs/csharp/language-reference/compiler-options

1 file changed

+2
-2
lines changed

docs/csharp/language-reference/compiler-options/advanced.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ You add any of these options in a `<PropertyGroup>` element in your `*.csproj` f
5656

5757
## MainEntryPoint or StartupObject
5858

59-
This option specifies the class that contains the entry point to the program, if more than one class contains a `Main` method.
59+
This option specifies the class that contains the entry point to the program when your compilation includes more than one type with a `Main` method. When there's exactly one acceptable `Main` method in the project, this option is ignored.
6060

6161
```xml
6262
<StartupObject>MyNamespace.Program</StartupObject>
@@ -68,7 +68,7 @@ or
6868
<MainEntryPoint>MyNamespace.Program</MainEntryPoint>
6969
```
7070

71-
Where `Program` is the type that contains the `Main` method. The provided class name must be fully qualified; it must include the full namespace containing the class, followed by the class name. For example, when the `Main` method is located inside the `Program` class in the `MyApplication.Core` namespace, the compiler option has to be `-main:MyApplication.Core.Program`. If your compilation includes more than one type with a [`Main`](../../fundamentals/program-structure/main-command-line.md) method, you can specify which type contains the `Main` method.
71+
Where `Program` is the type that contains the `Main` method. When this option is required (multiple `Main` methods exist), the provided class name must be fully qualified; it must include the full namespace containing the class, followed by the class name. For example, when the `Main` method is located inside the `Program` class in the `MyApplication.Core` namespace, the compiler option has to be `-main:MyApplication.Core.Program`. If the class is in the global namespace, the fully qualified name is the same as the simple class name (for example, `Program` instead of `MyNamespace.Program`).
7272

7373
> [!NOTE]
7474
> This option can't be used for a project that includes [top-level statements](../../fundamentals/program-structure/top-level-statements.md), even if that project contains one or more `Main` methods.

0 commit comments

Comments
 (0)