Skip to content

Improve msbuild configuration in Boilerplate (#9852)#9853

Merged
msynk merged 4 commits intobitfoundation:developfrom
yasmoradi:9852
Feb 10, 2025
Merged

Improve msbuild configuration in Boilerplate (#9852)#9853
msynk merged 4 commits intobitfoundation:developfrom
yasmoradi:9852

Conversation

@yasmoradi
Copy link
Member

@yasmoradi yasmoradi commented Feb 9, 2025

closes #9852

Summary by CodeRabbit

  • New Features

    • Added support for building the hybrid application for Android, enhancing mobile deployment options.
  • Refactor

    • Removed all Windows-specific build and configuration options, streamlining the overall solution structure.
    • Updated dynamic rendering logic to better adapt to different runtime environments.
  • Chores

    • Refined environment settings and build configurations for improved development and deployment workflows.

@yasmoradi yasmoradi requested a review from msynk February 9, 2025 22:03
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2025

Walkthrough

This 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

File(s) Change Summary
CI/CD Workflows
src/.../workflows/cd.yml (Azure DevOps) and
.github/workflows/cd.yml (GitHub)
Removed build_blazor_hybrid_windows job; added build_blazor_hybrid_android job; eliminated conditional Windows build logic.
Template Configurations
src/.../.template.config/ide.host.json and
src/.../.template.config/template.json
Removed Windows-specific component entry and parameter; eliminated exclusion conditions for Windows projects.
Solution & Project Files
src/.../Boilerplate.sln, src/.../Boilerplate.slnx,
src/.../*.csproj, and
src/.../Directory.Build.props
Removed Windows client project and conditional configuration blocks; updated MSBuild conditions for environment, debug, and SDK debugging; introduced a new solution structure with multiple build configurations.
Front-End Files
src/.../Client/Boilerplate.Client.Web/ClientWebSettings.cs and
src/.../Client/Boilerplate.Client.Maui/wwwroot/index.html
Modified render mode selection logic with conditional checks; removed Windows-specific stylesheet conditional inclusion.

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
Loading
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
Loading

Assessment against linked issues

Objective Addressed Explanation
Improve MSBuild configuration for boilerplate project template (#9852)

Poem

I hop along the lines of code with cheer,
Where Windows fades and Android shines clear.
Build jobs spring forth like carrots fresh and bright,
MSBuild paths now gleam in a streamlined light.
A rabbit sings of changes that make our code take flight!


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yasmoradi yasmoradi marked this pull request as ready for review February 10, 2025 10:35
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 Issue

The 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 Issue

The 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:

  1. Install sass globally in the CI environment
  2. Add a pre-build step to install node dependencies
  3. 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 BuildType entries.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 35d1f54 and c7ff0f3.

📒 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 Condition

Changing <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 Condition

The 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

@msynk msynk changed the title Improve Boilerplate msbuild configuration (#9852) Improve msbuild configuration in Boilerplate (#9852) Feb 10, 2025
@msynk msynk merged commit 6441641 into bitfoundation:develop Feb 10, 2025
3 checks passed
@yasmoradi yasmoradi deleted the 9852 branch February 11, 2025 11:47
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.

The msbuild configuration needs improvements in the Boilerplate project template

2 participants