Skip to content

Please document how to change default console template. #26313

Closed

Description

@alexanderpino

Could you please document how we can change the console template back to the 'classic' Program + Main.

adegeo EDIT

We've opened up a new issue specifically for voting on how you feel about the templates. #27420


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. tdykstra commented on Sep 30, 2021

    @tdykstra
    Contributor
  2. self-assigned this
    on Sep 30, 2021
  3. KathleenDollard commented on Sep 30, 2021

    @KathleenDollard
    Contributor

    There is no direct way to do this in .NET 6. There are two approaches:

    • Copy the code that appears in this docs article.
      • Either leave out the usings or remove remove implicit usings from your project file
    • Target .NET 5 in your template, and then change the framework to .NET 6 in your project file after the project is created

    We want feedback. Voting on this issue is one of the ways folks can provide feedback.

    @tdykstra @BillWagner would you update the docs to indicate this, and let me know if you need anything from me.

  4. BillWagner commented on Oct 1, 2021

    @BillWagner
    Member

    For now, you can do this:

    dotnet new console --framework net5.0
    

    Or, any other older framework.

    Then, you can change the TFM to .NET 6:

    <TargetFramework>net6.0</TargetFramework>
    
  5. adegeo commented on Oct 1, 2021

    @adegeo
    Contributor

    Use

    dotnet new console --framework net5.0 --target-framework-override net6.0
    

    This will generate the old-style template but force the framework in the project to net6.0

  6. Walluce commented on Oct 5, 2021

    @Walluce

    Can you please post a link to where I can vote against this new "feature"?

  7. svick commented on Oct 5, 2021

    @svick
    Member

    @Walluce If you want to suggest that the dotnet new console template should be changed, then the right repo would be dotnet/templating. There is already a somewhat related issue at dotnet/templating#3654.

    If you think the whole feature of top-level programs should be removed, then in theory, the right repo would be dotnet/csharplang. But since that feature is not really new (it has been released in C# 9.0 almost a year ago), I don't think a vote against it would have any effect at this point.

  8. tdykstra commented on Oct 5, 2021

    @tdykstra
    Contributor

    @svick The article asks for feedback as up/down votes on this issue -- see the Template feedback section, The reference is to using top-level statements in the new-project template, not to the top-level statements feature itself.

  9. Walluce commented on Oct 14, 2021

    @Walluce

    Use

    dotnet new console --framework net5.0 --target-framework-override net6.0
    

    This will generate the old-style template but force the framework in the project to net6.0

    This doesn't work :(

  10. 40 remaining items

  11. Kuinox commented on Nov 30, 2021

    @Kuinox

    Instead of "voting the new template", why can't we have both ?

  12. symbiotic commented on Dec 5, 2021

    @symbiotic

    This is confusing. Almost hit the wrong vote because the whole description is misleading.

    "Template feedback The top-level template is a new feature in .NET 6. Add an up or down vote GitHub issue #26313 to voice your support for this feature." From https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates

    Agreed. I suggest we redo the voting, in a new GitHub issue that does not conflict with the page asking for feedback. The page currently says "to voice your support for this feature", but this issue says "Could you please document how we can change the console template back to the 'classic' Program + Main". These votes are ambiguous.

    This template is less usable, mainly because the arguments and return value are hidden.

    I'm also concerned about the decision process at Microsoft, behind such a change making it into Visual Studio / .NET.

  13. tdykstra commented on Dec 6, 2021

    @tdykstra
    Contributor

    The comment in the templates article has been changed from:

    The top-level template is a new feature in .NET 6. Add an up or down vote GitHub issue #26313 to voice your support for this feature.

    to:

    Top-level statements is a new feature in .NET 6. Add an up or down vote in GitHub issue #26313 to let us know if you support the use of this feature in project templates.

  14. adegeo commented on Dec 6, 2021

    @adegeo
    Contributor

    @tdykstra It may be better to open a new issue, I don't think any vote can be trusted 😁

  15. rfvan commented on Dec 6, 2021

    @rfvan

    @tdykstra I agree with @adegeo - there are up and down votes splattered across many of the posts to this string and I suspect there was a lot of confusion as to which choice people were making. Please start a new issue with an unequivocal question so that it is completely clear what one is voting for or against.

  16. tdykstra commented on Dec 6, 2021

    @tdykstra
    Contributor

    Please start a new issue with an unequivocal question so that it is completely clear what one is voting for or against.

    See #27420

  17. rhrytskiv commented on Dec 7, 2021

    @rhrytskiv

    Please just add an option to choose if I want old or new style template instead of sdk switching this is very annoying.

  18. ahwm commented on Dec 7, 2021

    @ahwm

    Please just add an option to choose if I want old or new style template instead of sdk switching this is very annoying.

    @rhrytskiv see #27420 (comment)

  19. died commented on Dec 13, 2021

    @died

    Please just add an option to choose if I want old or new style template instead of sdk switching this is very annoying.

    try this
    https://marketplace.visualstudio.com/items?itemName=Doomdied.ClassicConsole1

  20. tonysneed commented on Feb 12, 2022

    @tonysneed

    Made a suggested change to the docs with #28223.

  21. Earthman100 commented on Feb 17, 2022

    @Earthman100

    Could you please document how we can change the console template back to the 'classic' Program + Main.

    adegeo EDIT

    We've opened up a new issue specifically for voting on how you feel about the templates. #27420

    Document Details

    ⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

    Name that Apptdykstra< Rest Api_curl -I https://api.github.com/users/octocat/orgs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions