Improve msbuild configuration in Boilerplate (#9852)#9853
Improve msbuild configuration in Boilerplate (#9852)#9853msynk merged 4 commits intobitfoundation:developfrom yasmoradi:9852
Conversation
WalkthroughThis pull request updates the CI/CD pipeline and project configuration for a Blazor hybrid application template. The changes remove Windows-specific build jobs, parameters, and project references while introducing an Android build job and a new solution structure. Additionally, various MSBuild configuration files and conditional logic in project and front-end files have been updated to adjust environment- and configuration-based behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant CI as CI/CD Pipeline
participant Job as Android Build Job
participant Setup as Environment Setup
participant Build as Build Process
participant Upload as Artifact Upload
CI->>Job: Trigger build_blazor_hybrid_android
Job->>Setup: Initialize .NET, Node.js, MAUI, Android SDK
Setup-->>Job: Setup complete
Job->>Build: Update config, generate CSS/JS, publish AAB
Build->>Upload: Upload artifact
sequenceDiagram
participant Config as Build Configuration
participant Options as WebAppRenderOptions
participant ModeDecision as Render Mode Decision
Config->>Options: Evaluate active configuration
Options->>ModeDecision: Set mode (BlazorServer/BlazorWebAssembly)
ModeDecision->>Config: Return final render mode
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (4)
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj (1)
1-39: Address Pipeline Build Target IssueThe CI/CD pipeline error indicates that the target
"BeforeBuildTasks"does not exist in the project. Verify whether this target is expected by your build process. If it is required, consider adding its definition; otherwise, update your build configuration to remove the dependency on it.🧰 Tools
🪛 GitHub Actions: bit platform CI
[error] 1-1: The target "BeforeBuildTasks" does not exist in the project.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj (1)
1-102: Address Pipeline Build Target IssueThe pipeline error stating that the
"BeforeBuildTasks"target is missing suggests a misalignment between the project file and the CI/CD configuration. Confirm if you intended to define this custom target or if the build process should be updated to eliminate its expectation.🧰 Tools
🪛 GitHub Actions: bit platform CI
[error] 1-1: The target "BeforeBuildTasks" does not exist in the project.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj (1)
185-187: Fix sass command execution in CI pipeline.The sass command is failing in the CI pipeline because it can't find the sass executable. This needs to be fixed to ensure successful builds.
Consider these options:
- Install sass globally in the CI environment
- Add a pre-build step to install node dependencies
- Use a container with sass pre-installed
Example fix for option 1:
- <Exec Command="../Boilerplate.Client.Core/node_modules/.bin/sass .:. --style compressed --load-path=. --silence-deprecation=import" StandardOutputImportance="high" StandardErrorImportance="high" LogStandardErrorAsError="true" /> + <Exec Command="npm install -g sass && sass .:. --style compressed --load-path=. --silence-deprecation=import" StandardOutputImportance="high" StandardErrorImportance="high" LogStandardErrorAsError="true" />🧰 Tools
🪛 GitHub Actions: bit platform CI
[error] 186-186: /usr/bin/sh: 2: /tmp/MSBuildTemprunner/tmp92030fa0b8ad47ecb3f481af0a3cdc16.exec.cmd: ../Boilerplate.Client.Core/node_modules/.bin/sass: not found
[error] 186-186: The command "../Boilerplate.Client.Core/node_modules/.bin/sass .:. --style compressed --load-path=. --silence-deprecation=import" exited with code 127.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj (1)
1-91:Details
🧩 Analysis chain
Verify impact of removing Windows support.
This file is being removed as part of deprecating Windows support. Please ensure all Windows-specific dependencies and references have been removed from other parts of the codebase.
Run this script to check for remaining Windows references:
🏁 Script executed:
#!/bin/bash # Search for Windows-specific references in the codebase echo "Searching for Windows-specific project references..." rg -l "Boilerplate\.Client\.Windows" echo "Searching for Windows-specific imports..." rg -l "using.*Windows" echo "Searching for Windows-specific conditional compilation..." rg -l "#if.*Windows"Length of output: 2890
Windows support removal is incomplete. The search results indicate that while the Windows-specific csproj is being removed, numerous Windows-related files and references are still present in the repository. In particular:
- Project References: Multiple files under the
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/directory (e.g.,Program.cs,Program.Services.cs, various Windows service implementations) still exist.- Imports and Conditionals: There are Windows-specific imports in other parts of the codebase (including in demo projects and the Maui platform extensions) as well as conditional compilation directives in
MauiProgram.cs.Given that the removal of Windows support should also clean up these dependencies, please verify whether these references are still required or if they can be removed/updated accordingly.
🧹 Nitpick comments (2)
src/Templates/Boilerplate/Bit.Boilerplate/Boilerplate.slnx (2)
2-9: Fix indentation in build configurations.The build configurations are well-structured, but there's inconsistent indentation for some
BuildTypeentries.Apply this diff to maintain consistent indentation:
<Configurations> <BuildType Name="Debug" /> <BuildType Name="DebugBlazorServer" /> - <BuildType Name="DebugBlazorWasm" /> - <BuildType Name="DebugBlazorHybridMaui" /> - <BuildType Name="DebugBlazorHybridWindows" /> + <BuildType Name="DebugBlazorWasm" /> + <BuildType Name="DebugBlazorHybridMaui" /> + <BuildType Name="DebugBlazorHybridWindows" /> <BuildType Name="Release" /> </Configurations>
53-58: Fix indentation in Windows client project configuration.The Windows client project configuration has inconsistent indentation.
Apply this diff to maintain consistent indentation:
<Project Path="src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj"> - <Build Solution="DebugBlazorHybridMaui|*" Project="false" /> - <Build Solution="DebugBlazorServer|*" Project="false" /> - <Build Solution="DebugBlazorWasm|*" Project="false" /> + <Build Solution="DebugBlazorHybridMaui|*" Project="false" /> + <Build Solution="DebugBlazorServer|*" Project="false" /> + <Build Solution="DebugBlazorWasm|*" Project="false" /> </Project>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/Boilerplate.sln(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/Boilerplate.slnx(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj(3 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html(0 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/ClientWebSettings.cs(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj(1 hunks)
💤 Files with no reviewable changes (6)
- src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html
- src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json
- src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json
- src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml
- src/Templates/Boilerplate/Bit.Boilerplate/Boilerplate.sln
- src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml
🧰 Additional context used
🪛 GitHub Actions: bit platform CI
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj
[error] 1-1: The target "BeforeBuildTasks" does not exist in the project.
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj
[error] 1-1: The target "BeforeBuildTasks" does not exist in the project.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj
[error] 186-186: /usr/bin/sh: 2: /tmp/MSBuildTemprunner/tmp92030fa0b8ad47ecb3f481af0a3cdc16.exec.cmd: ../Boilerplate.Client.Core/node_modules/.bin/sass: not found
[error] 186-186: The command "../Boilerplate.Client.Core/node_modules/.bin/sass .:. --style compressed --load-path=. --silence-deprecation=import" exited with code 127.
🔇 Additional comments (8)
src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj (1)
33-36: Updated Debug Configuration ConditionChanging
<EnableSdkContainerDebugging>to be enabled when$(Environment)is"Development"clearly focuses debugging support on development environments rather than the build configuration. Ensure that this change aligns with your deployment practices and that the environment variable is properly maintained throughout your pipeline.src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj (1)
96-99: Updated Debug Configuration ConditionThe adjustment of
<EnableSdkContainerDebugging>to trigger on$(Environment)being"Development"brings consistency with the Server.Web project. Please ensure this aligns with how you distinguish development from production environments in your deployment workflow.src/Templates/Boilerplate/Bit.Boilerplate/Boilerplate.slnx (2)
10-20: Well-organized solution structure!The solution follows best practices with clear separation of concerns:
- Solution-level configuration files are properly organized
- Server, Client, Shared, and Tests projects are logically grouped
Also applies to: 34-61
21-33: Well-structured pipeline configuration!The conditional inclusion of pipeline-specific files is well-implemented, ensuring that only relevant workflow files are included based on the chosen pipeline type.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/ClientWebSettings.cs (1)
52-62: LGTM! Enhanced configuration flexibility for render modes.The changes allow seamless switching between BlazorServer and BlazorWebAssembly modes based on build configuration, which improves development workflow when using .slnx solutions in Visual Studio.
src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props (2)
20-21: LGTM! Enhanced build configuration system.The addition of specialized configurations (DebugBlazorServer, DebugBlazorWasm, etc.) improves build-time flexibility and supports the new render mode switching feature.
25-25: LGTM! Improved environment and configuration handling.The changes make environment detection more flexible and expose configuration constants to code, enabling better conditional compilation support.
Also applies to: 33-33
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj (1)
41-49: LGTM! Improved environment-based configuration.The changes to environment conditions make the build configuration more consistent by using
!= 'Development'instead of explicit environment checks.Also applies to: 56-65, 73-81
closes #9852
Summary by CodeRabbit
New Features
Refactor
Chores