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
{{ message }}
Repository navigation
Use the old program style: Add info on converting top-level statements to explicit entry point #28223
In the section, Use the old program style, add information on how to convert an existing .NET 6 console or web app to use an explicit entry point instead of top-level statements. For example, in a .NET 6 console app you can simply replace the code in Program.cs with the following:
Thanks for the suggestion, but this article is about creating new projects, and it already shows the old template code near the top of the article. Web app templates are covered in the ASP.NET Core documentation.
@tdykstra Is there another place in the docs which covers converting an existing .NET 6 console or web app to use an explicit entry point?
By way of background, the question came up for me with an integration tests that needed to reference more than one web project. Because Program now exists in the global namespace, it caused an ambiguous reference in the test project.
@tdykstra this may be a missing scenario, approaching it from the point of view that @tonysneed is indicating. In general the requests have been from the context of "restore the old template" which the article covers. But the context here, I believe, is a missing scenario: "How do I specify an entry point for an app"
Activity
tdykstra commentedon Feb 14, 2022
Thanks for the suggestion, but this article is about creating new projects, and it already shows the old template code near the top of the article. Web app templates are covered in the ASP.NET Core documentation.
tonysneed commentedon Feb 14, 2022
@tdykstra Is there another place in the docs which covers converting an existing .NET 6 console or web app to use an explicit entry point?
By way of background, the question came up for me with an integration tests that needed to reference more than one web project. Because
Programnow exists in the global namespace, it caused an ambiguous reference in the test project.adegeo commentedon Feb 23, 2022
@tdykstra this may be a missing scenario, approaching it from the point of view that @tonysneed is indicating. In general the requests have been from the context of "restore the old template" which the article covers. But the context here, I believe, is a missing scenario: "How do I specify an entry point for an app"
This would include:
tdykstra commentedon Feb 23, 2022
That doesn't seem to fit the context of an article that is specifically about project creation using the template. Maybe it would fit in https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements#implicit-entry-point-method -- we could add "if you need an explicit entry point" text. @BillWagner what do you think?