Add Microsoft.AspNetCore.OpenApi to the webapiaot template (with an optional flag to disable it) by sander1095 · Pull Request #60337 · dotnet/aspnetcore (original) (raw)

@sander1095 Absent running tests locally, we can rely on test failiures in CI to diagnose issues. Based on the build analysis, it seems like the templates are currently unbuildable because the correct usings for the TypedResult static methods are not in place.

Apologies, I didn't know there was such a handy UI with the explicit errors.

I've researched this, and I found that ImplicitUsings for ASP.NET Core projects does not add Microsoft.AspNetCore.Http.HttpResults to the list of global usings.

This means we need to make a choice:

  1. Either we add the Microsoft.AspNetCore.Http.HttpResults using explicitly (which I've just done in this PR, so we can at least see how much the the pipeline progresses)
  2. Add Microsoft.AspNetCore.Http.HttpResults to the list of global usings, which can be done in the SDK repo. I've already created a draft PR for this: Add HttpResults to the ImplicitUsings of ASP.NET Core projects so TypedResults/Results<T1,T2> don't need an explicit using sdk#47231

I'd prefer option 2 so we can keep the Program.cs file cleaner for new projects, and to remove an explicit using for existing projects. Of course this would mean that the SDK PR would need to reviewed and merged first before this PR can be finally merged.

What do you think, @captainsafia ? If you also agree with option 2, I can remove the draft status of the PR in the SDK repo