Skip to content

feat(scaffolder): adding Ignite UI for Blazor scaffolder - #3823

Merged
haileymck merged 20 commits into
dotnet:mainfrom
kdinev:feature/igniteui-blazor-scaffolder
Oct 28, 2026
Merged

haileymck merged 20 commits into
dotnet:mainfrom
kdinev:feature/igniteui-blazor-scaffolder

Conversation

@kdinev

@kdinev kdinev commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor
  • The code builds and tests pass (verified by our automated build checks)

  • Commit messages follow this format
    Summary of the changes
    - Detail 1
    - Detail 2

      Fixes #bugnumber
    
  • Tests for the changes have been added (for bug fixes / features)

  • Code meets the expectations our engineering guidelines.
    https://github.com/dotnet/aspnetcore/wiki/Engineering-guidelines

  • Review the guidelines for CONTRIBUTING.md for more details.

How was this tested?

I performed some manual tests on the initial submission with different project types and subsequently added automated integration test scenarios based on the same. Here are some of the scenarios I tested:

  • Running the scaffolder against an existing Blazor Sever project, which already has references to old versions of the packages. This scenario was throwing initially, hence the change in DetectBlazorWasmStep, which was validated with an integration test (failure before the change, pass after).
  • Running the scaffolder against an existing split project with no reference - scaffolder updates both server and client when invoked against the server project, and only the client, treating it like a standalone WASM when executed against the client one.
  • Running the scaffolder with only one package selected against different project types - Lite, then GridLite
  • More variations of the above

Subsequently, based on PR comments, the scaffolder functionality changed to always add both packages and to preserve existing IgniteUI.Blazor commercial package references, without adding Lite references, and to also not modify existing theme selections already present in the target project.

@danroth27

Copy link
Copy Markdown
Member

Reuse the shared Blazor WebAssembly client discovery

Please use BlazorWebAssemblyClientProjectResolver from #3872 (now merged) instead of DetectBlazorWasmStep for this scaffolder. It uses evaluated MSBuild project references and the Blazor WebAssembly SDK marker, rather than parsing CLI reference output and restored package metadata.

Discovery itself should not require the client to have been restored first. A missing referenced project, failed evaluation, or multiple WebAssembly clients should produce an actionable error before making changes, rather than silently skipping the client or choosing the first match. A valid server-only app should continue to work without a client.

Keep the current intended placement: configure packages, services, and imports in the server and discovered client as appropriate, and link the stylesheet only in the server host page. Update the documentation to remove the prior-restore requirement and silent-skipping limitation.

@danroth27

Copy link
Copy Markdown
Member

Simplify setup by installing both component sets by default

I suggest removing the --package option and having the scaffolder install and configure both IgniteUI.Blazor.Lite and IgniteUI.Blazor.GridLite by default, equivalent to the current --package All behavior.

That makes the experience simply "add Ignite UI to my Blazor app," without requiring users to understand how the components are divided into NuGet packages. Users who want a smaller setup can remove the parts they do not need afterward.

The simplest invocation would then be:

dotnet scaffold aspnet blazor-igniteui --project .\MyApp\MyApp.csproj

The optional theme settings would remain unchanged. Please keep the existing "Ignite UI for Blazor" display name and Blazor category.

@danroth27

Copy link
Copy Markdown
Member

Validate supported projects, theme values, and package conflicts before editing

Please reject explicitly invalid --theme and --theme-variant values with an actionable error listing the supported values, rather than logging an informational message and substituting defaults. Defaults should apply when the options are omitted.

Please also establish that the target is a supported Blazor project before modifying it, without requiring the exact default template layout. Currently the validation checks project existence and project analysis but does not explicitly establish that it is a supported Blazor app.

Before adding Lite, detect an existing commercial IgniteUI.Blazor package and report the incompatibility rather than introducing duplicate components/namespaces. Use evaluated package references for the relevant server/client projects so imported and conditional references are accounted for, not just a text search of the server .csproj.

@danroth27

Copy link
Copy Markdown
Member

Do not report incomplete required setup as success

Please rebase on current main to pick up the shared package-installation failure handling. At this PR's current base, AddPackagesStep ignores the result of DotnetCommands.AddPackage and continues; main now reports the error, returns failure, and stops later steps.

For the new setup steps, please do not use ContinueOnError = true for required imports or stylesheet changes. Likewise, if a required code-modification configuration cannot be found, report an error instead of silently setting SkipStep and omitting the service registration. Required setup failures should propagate to a failed operation/process result rather than ordinary success.

The manual stylesheet instructions for a customized host page are useful, but if that required setup cannot be completed automatically, clearly report that the setup is incomplete and what remains to be done. Please update the troubleshooting text that currently says package installation failures continue through the remaining steps.

Reuse the shared failure-handling infrastructure rather than adding a separate Ignite UI package runner.

@danroth27

Copy link
Copy Markdown
Member

Configure the interactivity required by the components

Since Ignite UI components require interactivity, the scaffolder should configure the necessary hosting support rather than only warn when it is missing.

For Blazor Web Apps, preserve any existing Server, WebAssembly, or Auto configuration and complete the library setup for that configuration. If the app has no interactivity configured, enable Blazor Server support by adding AddInteractiveServerComponents() to the existing service-registration chain and AddInteractiveServerRenderMode() to the corresponding endpoint-mapping chain. Use the shared code-modification recipes and avoid duplicate registrations.

Please do not change the global render modes on <Routes> or <HeadOutlet>, or add render modes to existing pages. Enabling interactive hosting support should not turn the app's existing static-SSR pages into interactive pages. Existing Blazor Server and standalone WebAssembly apps should retain their hosting model.

Since this scaffolder does not generate a component page, completion guidance should explain that pages using Ignite UI need an appropriate interactive render mode - for example, @rendermode InteractiveServer when Server support was added. Avoid suggesting InteractiveAuto unless Auto is configured.

@danroth27

Copy link
Copy Markdown
Member

Suggestion: preserve existing theme settings on reruns

Consider preserving the app's existing Ignite UI theme and light/dark variant when the corresponding options are omitted. Currently, omitted options default to Bootstrap/light and can replace a deliberately configured theme on a rerun.

Bootstrap/light would remain the default for initial setup when no theme exists. If the user explicitly supplies only --theme or only --theme-variant, the scaffolder could change that setting while preserving the other existing setting.

This would make reruns less likely to change the app's appearance unexpectedly, while retaining the existing protections against duplicate imports and service registrations.

@danroth27

danroth27 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Instead of using custom file parsing and editing logic to reference the stylesheet, we should use the shared JSON code-modification recipes.

The existing recipe engine handles Blazor Web App App.razor and legacy _Host.cshtml/_Layout.cshtml hosts. Standalone WebAssembly's wwwroot\index.html needs a small shared-infrastructure change: #3879.

Keep theme and host-page analysis in the scaffolder and pass the resulting values into the recipes, including the appropriate plain or @Assets link syntax. Once #3879 is available, use the recipe path for standalone HTML as well. Inserting before </head> is sufficient; reproducing the custom last-link insertion-position logic is not necessary.

@danroth27 danroth27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this contribution. Great start! I left a few comments and suggestions.

@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Reuse the shared Blazor WebAssembly client discovery

Please use BlazorWebAssemblyClientProjectResolver from #3872 (now merged) instead of DetectBlazorWasmStep for this scaffolder. It uses evaluated MSBuild project references and the Blazor WebAssembly SDK marker, rather than parsing CLI reference output and restored package metadata.

Discovery itself should not require the client to have been restored first. A missing referenced project, failed evaluation, or multiple WebAssembly clients should produce an actionable error before making changes, rather than silently skipping the client or choosing the first match. A valid server-only app should continue to work without a client.

Keep the current intended placement: configure packages, services, and imports in the server and discovered client as appropriate, and link the stylesheet only in the server host page. Update the documentation to remove the prior-restore requirement and silent-skipping limitation.

Addressed with 7a4ce67

@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Simplify setup by installing both component sets by default

I suggest removing the --package option and having the scaffolder install and configure both IgniteUI.Blazor.Lite and IgniteUI.Blazor.GridLite by default, equivalent to the current --package All behavior.

That makes the experience simply "add Ignite UI to my Blazor app," without requiring users to understand how the components are divided into NuGet packages. Users who want a smaller setup can remove the parts they do not need afterward.

The simplest invocation would then be:

dotnet scaffold aspnet blazor-igniteui --project .\MyApp\MyApp.csproj

The optional theme settings would remain unchanged. Please keep the existing "Ignite UI for Blazor" display name and Blazor category.

Addressed with 0b1d268

…azor Hybrid to supported projects. Detecting IgniteUI.Blazor existence
@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Validate supported projects, theme values, and package conflicts before editing

Please reject explicitly invalid --theme and --theme-variant values with an actionable error listing the supported values, rather than logging an informational message and substituting defaults. Defaults should apply when the options are omitted.

Please also establish that the target is a supported Blazor project before modifying it, without requiring the exact default template layout. Currently the validation checks project existence and project analysis but does not explicitly establish that it is a supported Blazor app.

Before adding Lite, detect an existing commercial IgniteUI.Blazor package and report the incompatibility rather than introducing duplicate components/namespaces. Use evaluated package references for the relevant server/client projects so imported and conditional references are accounted for, not just a text search of the server .csproj.

Addressed with d3b51e7

When doing the supported Blazor projects, I realised that I hadn't included the MAUI Blazor Hybrid app, so I added that.

…ing and continuing. Exiting on mandatory incomplete steps.
@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Do not report incomplete required setup as success

Please rebase on current main to pick up the shared package-installation failure handling. At this PR's current base, AddPackagesStep ignores the result of DotnetCommands.AddPackage and continues; main now reports the error, returns failure, and stops later steps.

For the new setup steps, please do not use ContinueOnError = true for required imports or stylesheet changes. Likewise, if a required code-modification configuration cannot be found, report an error instead of silently setting SkipStep and omitting the service registration. Required setup failures should propagate to a failed operation/process result rather than ordinary success.

The manual stylesheet instructions for a customized host page are useful, but if that required setup cannot be completed automatically, clearly report that the setup is incomplete and what remains to be done. Please update the troubleshooting text that currently says package installation failures continue through the remaining steps.

Reuse the shared failure-handling infrastructure rather than adding a separate Ignite UI package runner.

Addressed with 51c9ac5

The AddPackageStep comment was already addressed with 7a4ce67, I believe.

  • AddRazorImportsStep and AddIgniteUIThemeStylesheetStep no longer have ContinueOnError.
  • Missing host page or <head> finishes and reports an incomplete setup with the <link> to add
  • When Program.cs or MauiProgram.cs has a shape the shared code modifier doesn't recognise, a check for AddIgniteUIBlazor is performed, and if not found the run fails with the using and outputs the lines to add manually and then to re-run the scaffolder.
  • The troubleshooting docs no longer state the process continues through failures. There's also a new Failures and Incomplete Setup section
@kdinev

kdinev commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Configure the interactivity required by the components

Since Ignite UI components require interactivity, the scaffolder should configure the necessary hosting support rather than only warn when it is missing.

For Blazor Web Apps, preserve any existing Server, WebAssembly, or Auto configuration and complete the library setup for that configuration. If the app has no interactivity configured, enable Blazor Server support by adding AddInteractiveServerComponents() to the existing service-registration chain and AddInteractiveServerRenderMode() to the corresponding endpoint-mapping chain. Use the shared code-modification recipes and avoid duplicate registrations.

Please do not change the global render modes on <Routes> or <HeadOutlet>, or add render modes to existing pages. Enabling interactive hosting support should not turn the app's existing static-SSR pages into interactive pages. Existing Blazor Server and standalone WebAssembly apps should retain their hosting model.

Since this scaffolder does not generate a component page, completion guidance should explain that pages using Ignite UI need an appropriate interactive render mode - for example, @rendermode InteractiveServer when Server support was added. Avoid suggesting InteractiveAuto unless Auto is configured.

Addressed with 436cdad

The change here is not small (not that previous ones are). There was logic for interactivity detection in the ValidateIdentityStep that could be reused and I extracted it into a shared BlazorInteractivityAnalyzer.

@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Instead of using custom file parsing and editing logic to reference the stylesheet, we should use the shared JSON code-modification recipes.

The existing recipe engine handles Blazor Web App App.razor and legacy _Host.cshtml/_Layout.cshtml hosts. Standalone WebAssembly's wwwroot\index.html needs a small shared-infrastructure change: #3879.

Keep theme and host-page analysis in the scaffolder and pass the resulting values into the recipes, including the appropriate plain or @Assets link syntax. Once #3879 is available, use the recipe path for standalone HTML as well. Inserting before </head> is sufficient; reproducing the custom last-link insertion-position logic is not necessary.

Addressed, together with the comment about preserving existing theme imports, with d936c6b

@kdinev

kdinev commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@danroth27 Thank you very much for the thorough review! I believe all comments and suggestions have been addressed.

…ously dismissed on the StableNuGetConfig in integration tests
@kdinev

kdinev commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

@danroth27 The CI started failing, but I'm unable to determine that this is caused by a change I made. All tests pass locally and I suspect this may be caused by a change that made it into the repo. If you can point me to what changed, I will try to adjust to it.

@danroth27

Copy link
Copy Markdown
Member

@danroth27 The CI started failing, but I'm unable to determine that this is caused by a change I made. All tests pass locally and I suspect this may be caused by a change that made it into the repo. If you can point me to what changed, I will try to adjust to it.

The failures are due to some issues on our side getting the IgniteUI packages available on our feeds. I'm working on getting it resolved.

@danroth27

Copy link
Copy Markdown
Member

/azp run scaffolding-ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
@danroth27
danroth27 requested a review from haileymck October 16, 2026 00:24
danroth27
danroth27 previously approved these changes Oct 16, 2026

@danroth27 danroth27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor
…niteUIBlazor scaffolder by ignoring the comments link and swapping the real one

Addressing latest copilot review comments

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

One or more issues must be addressed before approval.

1 open issue
2 resolved since last review

Review effort: Balanced

…MauiProgram.cs actually referenced in a project

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

One or more issues must be addressed before approval.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Use project parse options when validating conditional registrations

src/​dotnet-scaffolding/​dotnet-scaffold/​AspNet/​ScaffoldSteps/​IgniteUIBlazor/​IgniteUICodeModificationStep.cs:130

Parsing the file without the project's CSharpParseOptions drops its preprocessor symbols. For example, AddIgniteUIBlazor inside '#if NET8_0_OR_GREATER' is active in a supported target project, but this parse treats it as disabled text and reports incomplete setup even when the registration is already correct. Verify the freshly read content with the target document's evaluated parse options so framework and configuration symbols are respected.

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

One or more issues must be addressed before approval.

No open issues 🎉

Review effort: Balanced

@haileymck
haileymck merged commit 11f92e1 into dotnet:main Oct 28, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants