You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "ASP0027: Analyzer to suggest removing unnecessary public Program class declaration"
3
+
ms.date: 03/25/2025
4
+
description: "Learn about analysis rule ASP0027: Unnecessary public Program class declaration"
5
+
author: benhopkinstech
6
+
monikerRange: '>= aspnetcore-10.0'
7
+
ms.author: riande
8
+
uid: diagnostics/asp0027
9
+
---
10
+
# ASP0027: Unnecessary `public Program` class declaration"
11
+
12
+
|| Value |
13
+
| - | - |
14
+
|**Rule ID**| ASP0027 |
15
+
|**Category**| Usage |
16
+
|**Fix is breaking or non-breaking**| Non-breaking |
17
+
18
+
## Cause
19
+
20
+
An unnecessary `public Program` class declaration within the `Program.cs` file.
21
+
22
+
## Rule description
23
+
24
+
Suggests to remove the unnecessary `public Program` class declaration as this is no longer required to make the generated `Program` class public in ASP.NET Core apps.
25
+
26
+
## How to fix violations
27
+
28
+
To fix a violation of this rule, remove the `public Program` class declaration within the `Program.cs` file.
29
+
30
+
## When to suppress warnings
31
+
32
+
The severity level of this diagnostic is Information. While the warning can be suppressed if necessary, it is recommended to remove the declaration as it is no longer required.
0 commit comments