Visual Studio does not retain 'Do not use top-level statements' check.
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
First of all, thank you ASP.NET Core Team for adding an option in templates to avoid top-level statement.
However, we have noticed that Visual Studio is not retaining the Do not use top-level statement
check.
First Time:
Second Time:
Note: All other checks are retaining their last choice.
Expected Behavior
Check should retain the last choice.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.300 and 7.0.100-preview.4.22252.9
Anything else?
Visual Studio Version: 2022 17.3 preview 1.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Visual Studio 2022 doesn't show the "Do not use top-level ...
Visual Studio 2022 doesn't show the "Do not use top-level statements" checkbox when creating new project.
Read more >How can I disable Top-level statements when using `dotnet ...
I created a C# project with the below command in VSCode and enabled Top-level statements automatically for this project. How can I disable...
Read more >C# console app template generates top-level statements
On this page, select the Do not use top-level statements check box. Visual Studio do not use top-level statements check box. After your...
Read more >Question - Trouble with Top-Level Statement
Hello Im a beginner at C# coding and trying to make a simple cmd prompt that shows the status of a service running....
Read more >Top-Level Statements in C# - Code Maze
In this article, we are going to learn about the top-level statements in C#. Whenever we start learning a new programming language, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Details for the change we need to make to the
ide.host.json
for each web project template, including the console template, in 7.0:@phenning is going to ensure that once we make this change in 7.0, any customer with both 6.x and 7.0 installed will see this option become sticky for all versions of the template available, i.e. it will become sticky in 6.x templates too.
/Cc @vlada-shubina
Yeah this fix is in the 7.0 SDK and thus will only apply to 6.0 projects when 7.0.100-preview.6 is installed. VS 17.4 will default to including .NET 7 SDK at which point this will be fixed for 6.0 projects too.