Skip to content

Commit 731eba8

Browse files
CopilotBillWagner
andauthored
Clarify StartupObject documentation: when it's needed and qualification requirements (#47726)
* Initial plan * Fix StartupObject documentation to clarify when it's needed and qualification requirements Co-authored-by: BillWagner <[email protected]> * Update docs/csharp/language-reference/compiler-options/advanced.md --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BillWagner <[email protected]> Co-authored-by: Bill Wagner <[email protected]>
1 parent b648936 commit 731eba8

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,13 +56,13 @@ You add any of these options in a `<PropertyGroup>` element in your `*.csproj` f
5656

5757
## 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 project 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>
6363
```
6464

65-
Where `Program` is the type that contains the `Main` method. The class name can be either fully qualified (including the namespace) or just the class name if it's unambiguous. For example, when the `Main` method is located inside the `Program` class in the `MyApplication.Core` namespace, you can specify either `-main:MyApplication.Core.Program` or just `-main:Program` if there's no ambiguity. 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.
65+
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`).
6666

6767
> [!NOTE]
6868
> 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)