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

Add Blazor support to an ASP.NET Core app #30791

Merged
merged 8 commits into from
Oct 20, 2023
Merged

Conversation

guardrex
Copy link
Collaborator

@guardrex guardrex commented Oct 20, 2023

@guardrex guardrex self-assigned this Oct 20, 2023
@guardrex
Copy link
Collaborator Author

@danroth27 .... I take it you mean in the first two scenarios without a donor that we'll show unstyled components? This goes down a rabbit hole showing a lot of code without it if we show Blazor styling ... and the layout ... and the nav menu. I'll start the write-up without it (no donor, no styling, no layout, no nav menu).

@guardrex
Copy link
Collaborator Author

Ok ... I have just the 🦴 bare bones 🦴 in place to see if this is the general direction that the first two sections need to go without a donor. If we get into the weeds down a rabbit hole 😄, I think the donor is better (i.e., layout, styles, nav menu, the works!). If we just need these absolutely minimal bits, then I think I have about what's needed in the first two sections.

@guardrex
Copy link
Collaborator Author

... and let me know for the 2nd section if you want to include .......

@using static Microsoft.AspNetCore.Components.Web.RenderMode

.... and change the Counter component over to ...

@rendermode InteractiveServer

@danroth27
Copy link
Member

@danroth27 .... I take it you mean in the first two scenarios without a donor that we'll show unstyled components? This goes down a rabbit hole showing a lot of code without it if we show Blazor styling ... and the layout ... and the nav menu. I'll start the write-up without it (no donor, no styling, no layout, no nav menu).

Yeah, unstyled. Just the minimum required. The existing app will likely already have its own layout and styles.

@guardrex
Copy link
Collaborator Author

It might be best for the last section if we merge the first two sections first but delete the third section, and then I can open a new PR with the third section for feedback. I can do that now if you want.

guardrex and others added 2 commits October 20, 2023 15:14
Co-authored-by: Daniel Roth <daroth@microsoft.com>
@guardrex
Copy link
Collaborator Author

Hold a sec ... I'm going to merge this and add the third section back on a new PR.

I'll do more work to the first two sections on Monday.

I can get your feedback on the third section today.

Stand-by for a sec ....................................... 🏃

@guardrex
Copy link
Collaborator Author

Oooooops! ... forgot to knock out the link. 🙈


When the app is run, the `Counter` component is accessed at the `/counter` endpoint.

### Enable interactive Auto or WebAssembly rendering
Copy link
Member

@danroth27 danroth27 Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also like to simplify this section to make it more minimalistic:

  • Clarify at the beginning that the user should first enable support for static server rendering if they don't have that already, like we do in the section on enabling interactive server rendering.
  • When creating the donor project use the --empty option. We're just trying to enable the project structure, not include the sample pages and content.
  • Remove step 2 to copy over Bootstrap and the styles. The existing app might not be using Bootstrap.
  • Remove step 4. The generated project without sample pages won't have a Components folder. We'll need to add a step to add a component to the client project to demonstrate that it's working.
  • Simplify step 10 given that the user has done a bunch of the described changes already as part of enabling static server rendering. Key things are to enable interactive WebAssembly support and to add the client project as an additional assembly
  • Step 11 is huge! 😮 I'd like to shrink it way down to just adding another Pages/Counter2.razor component to the client project with @rendermode InteractiveWebAssembly or InteractiveAuto.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok ... I'll put it on the new PR tho. That way, all lines go in clean for feedback.

Copy link
Member

@danroth27 danroth27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good! 👍 Most of my feedback is on slimming down the interactive webassembly section.

@guardrex guardrex merged commit 4c672d2 into main Oct 20, 2023
2 checks passed
@guardrex guardrex deleted the guardrex/blazor-integration branch October 20, 2023 19:28
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.

Document how to add Auto component rendering to a Blazor Server app in .NET 8
2 participants