Skip to content

Add native build verification script - #3

Merged
Calvindd2f merged 1 commit into
masterfrom
codex/wrap-binary-in-powershell-module-and-clean-repo
Nov 20, 2025
Merged

Calvindd2f merged 1 commit into
masterfrom
codex/wrap-binary-in-powershell-module-and-clean-repo

Conversation

@Calvindd2f

Copy link
Copy Markdown
Owner

Summary

  • add a verification script that compiles the native source for .NET Framework and .NET SDK targets and loads the orchestrator
  • document how to run the verification from Windows PowerShell and PowerShell 7+
  • ignore build artifacts created by the verification script

Testing

  • not run (PowerShell tooling is unavailable in this environment)

Codex Task

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Calvindd2f, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a fundamental architectural change to the OfficeScrubC2R module. Instead of relying on extensive PowerShell scripting and dynamic C# compilation, the module now acts as a streamlined wrapper for a pre-compiled native C# DLL. This refactoring aims to simplify the module's structure, improve maintainability, and ensure robust interaction with native Windows APIs. The change also includes a new verification script to confirm the native build process across different PowerShell environments.

Highlights

  • Architectural Refactor: The module has undergone a significant architectural refactor, transitioning from a PowerShell-heavy implementation with inline C# compilation to a lightweight PowerShell wrapper that directly loads a pre-compiled native C# DLL.
  • Module Simplification: The main PowerShell script (OfficeScrubC2R.ps1) and the utilities module (OfficeScrubC2R-Utilities.psm1) have been removed, replaced by a minimal module (OfficeScrubC2R.psm1) that exposes helper functions to interact with the native DLL.
  • Native Build Verification: A new verification script (tests/Verify-NativeBuild.ps1) has been added to ensure the native C# source compiles correctly for both .NET Framework (Windows PowerShell) and .NET SDK (PowerShell 7+) targets, and that the resulting assembly can be loaded.
  • Version Bump: The module version has been updated to 3.0.0, reflecting the major breaking changes and architectural shift.
  • Documentation Update: The README.md and module release notes have been thoroughly updated to reflect the new native wrapper approach, new commands, and the removal of legacy script-based functions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and positive architectural refactoring, moving the core logic into a native C# DLL and simplifying the PowerShell module into a lightweight wrapper. This change should improve performance and maintainability. The addition of the Verify-NativeBuild.ps1 script is excellent, as it provides a robust way to validate the native compilation process across different .NET environments.

My review includes a couple of suggestions for the new verification script to enhance its robustness and error handling. Overall, this is a high-quality contribution that modernizes the project's architecture.

"@ | Set-Content -Path $projectPath -Encoding UTF8

Write-Host "Building .NET SDK assembly targeting $Framework" -ForegroundColor Cyan
dotnet build $projectPath -nologo -clp:NoSummary -p:GenerateAssemblyInfo=false | Write-Host

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Piping the output of dotnet build directly to Write-Host merges the standard output and error streams into the information stream. This can make it harder to spot build errors, as they will not be displayed as PowerShell errors. Removing the pipe to Write-Host will allow PowerShell to handle the output streams correctly, rendering errors in red as expected.

    dotnet build $projectPath -nologo -clp:NoSummary -p:GenerateAssemblyInfo=false

Comment thread tests/Verify-NativeBuild.ps1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +30
$frameworkCandidates = @(
Join-Path $env:WINDIR 'Microsoft.NET\\Framework64\\v4.0.30319\\csc.exe'),
Join-Path $env:WINDIR 'Microsoft.NET\\Framework\\v4.0.30319\\csc.exe'
) | Where-Object { $_ -and (Test-Path $_) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve syntax error in .NET Framework compiler search

The new verification script won't parse because the $frameworkCandidates array is initialized with an extra closing parenthesis (Join-Path ...),), which causes PowerShell to throw before any logic runs. As written, invoking tests/Verify-NativeBuild.ps1 fails immediately instead of checking the native build.

Useful? React with 👍 / 👎.

Comment thread tests/Verify-NativeBuild.ps1
@Calvindd2f
Calvindd2f merged commit 12990f2 into master Nov 20, 2025
1 of 3 checks passed
@Calvindd2f
Calvindd2f deleted the codex/wrap-binary-in-powershell-module-and-clean-repo branch November 20, 2025 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant