Skip to content

[ASPNETCORE] Add/improve support for .NET 8-10#23348

Closed
MisinformedDNA wants to merge 7 commits intoOpenAPITools:masterfrom
MisinformedDNA:net8
Closed

[ASPNETCORE] Add/improve support for .NET 8-10#23348
MisinformedDNA wants to merge 7 commits intoOpenAPITools:masterfrom
MisinformedDNA:net8

Conversation

@MisinformedDNA
Copy link
Copy Markdown

@MisinformedDNA MisinformedDNA commented Mar 25, 2026

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Modernized the ASP.NET Core server generator for .NET 8–10. Adds minimal-hosting templates and presets for 9.0/10.0, plus CI to build the new samples.

  • New Features

    • Added aspnetcore/8.0 templates with minimal hosting (Program.mustache), no Startup, new auth/filters/formatters, and OpenAPI helpers.
    • Updated project templates to include Nullable and ImplicitUsings; added new Dockerfile templates using mcr.microsoft.com/dotnet/aspnet and mcr.microsoft.com/dotnet/sdk with ports 8080/8081.
    • Introduced config presets for 9.0 and 10.0 (base, NewtonsoftFalse, nullableReferenceTypes, pocoModels, project4Models, useSwashBuckle, use-centralized-package-version-management) pointing to the new 8.0 templates.
    • Added GitHub Actions workflows to build .NET 9 and 10 sample servers.
    • Regenerated the .NET 8 petstore sample to use minimal hosting and the new Docker image/port setup.
  • Migration

    • Regenerate ASP.NET Core servers with aspnetCoreVersion set to 8.0, 9.0, or 10.0 and templateDir set to modules/openapi-generator/src/main/resources/aspnetcore/8.0.
    • Remove Startup.cs; the new output uses top-level Program.cs with minimal hosting.
    • Update containers to use mcr.microsoft.com/dotnet/aspnet and mcr.microsoft.com/dotnet/sdk and switch exposed ports from 80/443 to 8080/8081.
    • If you mapped old ports in deployment, adjust ingress/service mappings accordingly.

Written for commit 0a2adfc. Summary will update on new commits.

… Docker

- Add aspnetcore/8.0 template directory (based on 3.0 baseline)
- Rewrite Program.mustache to minimal hosting (top-level statements, no Startup)
- Update Dockerfile.mustache to use dotnet/aspnet and dotnet/sdk images
  (removes /core/ path prefix), switch ports from 80/443 to 8080/8081
- Add Nullable and ImplicitUsings to Project.csproj.mustache
- Remove Startup.mustache from processOpts() supporting files list
- Point all aspnetcore-8.0/9.0/10.0 bin/configs to new aspnetcore/8.0 templateDir
- Regenerate aspnetcore-8.0 petstore sample with updated templates
- Remove stale Startup.cs from aspnetcore-8.0 sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant