Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ASP.NET Core C# project templates to use new minimal hosting APIs in .NET 6 #33944

Closed
Tracked by #32378
DamianEdwards opened this issue Jun 29, 2021 · 12 comments
Closed
Tracked by #32378
Assignees
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-minimal-hosting feature-templates User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@DamianEdwards
Copy link
Member

The ASP.NET Core project templates included in the SDK should be updated to use the new minimal hosting APIs introduced in .NET 6 as they represent the new idiomatic way to bootstrap (configure and start) the relevant host for the majority of scenarios.

  • The CreateHostBuilder method would be removed as the patterns that were previously reliant on this are no longer necessary
  • The Startup class would be removed and its contents applied as applicable to the calls to WebApplicationBuilder in Program.cs
  • Change to Blazor WebAssembly hosted templates tracked in Update blazorwasm-hosted templates to use minimal host #32471
@DamianEdwards DamianEdwards added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates User Story A single user-facing feature. Can be grouped under an epic. feature-templates feature-minimal-hosting labels Jun 29, 2021
@DamianEdwards DamianEdwards self-assigned this Jun 29, 2021
@DamianEdwards DamianEdwards added this to the Next sprint planning milestone Jun 29, 2021
@ghost
Copy link

ghost commented Jun 29, 2021

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@Tratcher
Copy link
Member

FYI @jmprieur @jennyf19

@jmprieur
Copy link
Contributor

@DamianEdwards : are there examples of the new projects (or already converted templates?)?
cc: @Tratcher @jennyf19

@jmprieur
Copy link
Contributor

Thanks @Tratcher. I didn't even know that this could build.
Where would you do the services.AddAuthentication() ? and the app.UseAuthentication() ?

@Tratcher
Copy link
Member

Services are on builder.Services, app.UseAuthentication() goes between the exception handlers and the routes.

We'll update the StarterWeb templates and then you can copy or iterate on those as needed.

@DamianEdwards
Copy link
Member Author

@jmprieur you can see these changes WIP in #34016

@jmprieur
Copy link
Contributor

jmprieur commented Jul 3, 2021

@DamianEdwards : so you've done the work?
Should we then just update the templates to use the latest version of MIcrosoft.Identity.Web and its latest features?
cc: @jennyf19

@DamianEdwards
Copy link
Member Author

@jmprieur sorry didn't realize the arrangement here that you typically update the parts of the files relevant to org auth. Would be great if you could update the templates to use latest version of Microsoft.Identity.Web and its latest features once my PR is in.

@DamianEdwards DamianEdwards changed the title Update ASP.NET Core project templates to use new minimal hosting APIs in .NET 6 Update ASP.NET Core C# project templates to use new minimal hosting APIs in .NET 6 Jul 6, 2021
@jmprieur
Copy link
Contributor

jmprieur commented Jul 6, 2021

@DamianEdwards, there isn't really an arrangement.
but yes, I'll do that. Please tell me when it is

To test the updated templates, I installed VS2022 and .NET 6. Will that be enough? or should I install internal bits for the runtime and SDK? (and in that case where to get them from)?

@DamianEdwards
Copy link
Member Author

It depends on how soon you want to test them. If you want to do it as soon as they're committed to the aspnetcore repo you'll need to set things up locally for development in the repo itself. Or you can wait until the changes flow to the SDK installer and then you can simply install a CI build from dotnet/installer

@DamianEdwards
Copy link
Member Author

Fixed in #7699bab0fc5b1451272c7873af45990932d3d148

DamianEdwards added a commit that referenced this issue Jul 7, 2021
- Use top-level statements
- Use minimal hosting APIs
- #33947 #33944
DamianEdwards added a commit that referenced this issue Jul 8, 2021
* Update templates baseline for recent changes
* Add using alias to fix type name conflict in templates that were missed in the previous set of changes.
* Update SPA templates
  - Use top-level statements
  - Use minimal hosting APIs
  - #33947 #33944
* Fix nullable issue in Blazor Server template
@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2021
@amcasey amcasey added the area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc label Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-minimal-hosting feature-templates User Story A single user-facing feature. Can be grouped under an epic.
Projects
None yet
Development

No branches or pull requests

4 participants