You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(scaffolder): adding Ignite UI for Blazor scaffolder - #3823
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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
@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 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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:
DetectBlazorWasmStep, which was validated with an integration test (failure before the change, pass after).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.