-
Notifications
You must be signed in to change notification settings - Fork 296
Refactor build/versioning: shell-agnostic builds, auto NuGet versioning, and Copilot-ready workflow #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/experimental
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the build system for WindowsAppSDK-Samples by introducing a new PowerShell-based build script, improving version management, and adding contributor guidance.
- Refactored build system from batch to PowerShell with automatic environment detection and improved diagnostics
- Enhanced UpdateVersions.ps1 to require WinAppSDKVersion parameter and auto-download necessary NuGet packages
- Added comprehensive contributor guidance in .github/copilot-instructions.md
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
build.ps1 | New PowerShell build script with robust solution discovery, VS environment initialization, and MSBuild invocation |
build.cmd | Refactored to thin wrapper that calls build.ps1, removing complex batch logic |
UpdateVersions.ps1 | Made WinAppSDKVersion parameter mandatory and added automatic NuGet package installation |
.github/copilot-instructions.md | New contributor guidance covering build usage, versioning, coding guidelines, and PR processes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
./build.ps1 -Platform arm64 -Configuration Debug -Sample AppLifecycle | ||
(Build only the AppLifecycle sample solutions for arm64 Debug.) | ||
#> | ||
#[CmdletBinding()] parameters |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment '#[CmdletBinding()] parameters' is grammatically incorrect. It should be '#[CmdletBinding()] param' or a more descriptive comment like '# Parameters definition'.
#[CmdletBinding()] parameters | |
# Parameters definition |
Copilot uses AI. Check for mistakes.
# Restore-Solution: Perform NuGet restore for a solution (.sln) using repo nuget.exe. | ||
function Restore-Solution { param([string]$SolutionPath) | ||
Write-Host "Restoring: $SolutionPath" -ForegroundColor Cyan | ||
& $nugetExe restore $SolutionPath -ConfigFile (Join-Path $samplesRoot 'nuget.config') -PackagesDirectory $packagesDir | ||
if ($LASTEXITCODE -ne 0) { Write-Error 'NuGet restore failed.'; exit $LASTEXITCODE } | ||
} | ||
|
||
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | ||
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) | ||
$binlog = Join-Path (Split-Path $SolutionPath -Parent) ("{0}.binlog" -f ([IO.Path]::GetFileNameWithoutExtension($SolutionPath))) | ||
Write-Host "Building: $SolutionPath" -ForegroundColor Cyan | ||
& msbuild /warnaserror /p:Platform=$Platform /p:Configuration=$Configuration /p:NugetPackageDirectory=$packagesDir /bl:"$binlog" "$SolutionPath" | ||
if ($LASTEXITCODE -ne 0) { Write-Error 'MSBuild failed.'; exit $LASTEXITCODE } | ||
} |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this function and the following Build-Solution function have an extra leading space compared to other functions. All functions should use consistent indentation.
# Restore-Solution: Perform NuGet restore for a solution (.sln) using repo nuget.exe. | |
function Restore-Solution { param([string]$SolutionPath) | |
Write-Host "Restoring: $SolutionPath" -ForegroundColor Cyan | |
& $nugetExe restore $SolutionPath -ConfigFile (Join-Path $samplesRoot 'nuget.config') -PackagesDirectory $packagesDir | |
if ($LASTEXITCODE -ne 0) { Write-Error 'NuGet restore failed.'; exit $LASTEXITCODE } | |
} | |
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | |
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) | |
$binlog = Join-Path (Split-Path $SolutionPath -Parent) ("{0}.binlog" -f ([IO.Path]::GetFileNameWithoutExtension($SolutionPath))) | |
Write-Host "Building: $SolutionPath" -ForegroundColor Cyan | |
& msbuild /warnaserror /p:Platform=$Platform /p:Configuration=$Configuration /p:NugetPackageDirectory=$packagesDir /bl:"$binlog" "$SolutionPath" | |
if ($LASTEXITCODE -ne 0) { Write-Error 'MSBuild failed.'; exit $LASTEXITCODE } | |
} | |
# Restore-Solution: Perform NuGet restore for a solution (.sln) using repo nuget.exe. | |
function Restore-Solution { param([string]$SolutionPath) | |
Write-Host "Restoring: $SolutionPath" -ForegroundColor Cyan | |
& $nugetExe restore $SolutionPath -ConfigFile (Join-Path $samplesRoot 'nuget.config') -PackagesDirectory $packagesDir | |
if ($LASTEXITCODE -ne 0) { Write-Error 'NuGet restore failed.'; exit $LASTEXITCODE } | |
} | |
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | |
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) | |
$binlog = Join-Path (Split-Path $SolutionPath -Parent) ("{0}.binlog" -f ([IO.Path]::GetFileNameWithoutExtension($SolutionPath))) | |
Write-Host "Building: $SolutionPath" -ForegroundColor Cyan | |
& msbuild /warnaserror /p:Platform=$Platform /p:Configuration=$Configuration /p:NugetPackageDirectory=$packagesDir /bl:"$binlog" "$SolutionPath" | |
if ($LASTEXITCODE -ne 0) { Write-Error 'MSBuild failed.'; exit $LASTEXITCODE } | |
} |
Copilot uses AI. Check for mistakes.
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | ||
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this function has an extra leading space compared to other functions. All functions should use consistent indentation.
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | |
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) | |
# Build-Solution: Invoke MSBuild on a solution with platform/config and emit binlog. | |
function Build-Solution { param([string]$SolutionPath,[string]$Platform,[string]$Configuration) |
Copilot uses AI. Check for mistakes.
) | ||
|
||
# Prerequisites | ||
# If the NuGetPackagesFolder parameter wasn't provided, |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has a trailing comma that should be removed for proper grammar.
# If the NuGetPackagesFolder parameter wasn't provided, | |
# If the NuGetPackagesFolder parameter wasn't provided |
Copilot uses AI. Check for mistakes.
Description
Build system modernization:
build.ps1
PowerShell script that replaces the logic previously inbuild.cmd
, providing robust solution discovery, environment initialization, NuGet package management, and MSBuild invocation with improved diagnostics and usage documentation. (build.ps1
)build.cmd
to become a thin wrapper that simply invokesbuild.ps1
, removing all direct build, restore, and timing logic from the batch script. (build.cmd
)Versioning improvements:
UpdateVersions.ps1
to require theWinAppSDKVersion
parameter and add logic to ensure the necessary NuGet packages are downloaded and available before proceeding, improving reliability for version bumps. (UpdateVersions.ps1
)Contributor guidance:
.github/copilot-instructions.md
file documenting build usage, versioning steps, coding guidelines, PR process, and design doc practices to ensure consistent and high-quality contributions. (.github/copilot-instructions.md
)Target Release
Please specify which release this PR should align >=1.8
Checklist
Note that /azp run currently isn't working for this repo.