Skip to content

[Build] Add flag to build-win.ps1 that allows to build Release.static target - #1408

Merged
Tom Tan (ThomsonTan) merged 4 commits into
microsoft:mainfrom
lucianopa-msft:lucianopa/build-win-fix
Feb 6, 2026
Merged

[Build] Add flag to build-win.ps1 that allows to build Release.static target#1408
Tom Tan (ThomsonTan) merged 4 commits into
microsoft:mainfrom
lucianopa-msft:lucianopa/build-win-fix

Conversation

@lucianopa-msft

Copy link
Copy Markdown
Member

We are building using this build-win.ps1 but we wanted to be able to use the "Release.static" target. But currently there is no such option to that.
We currently have our own workaround:

function Repair-BuildScript {
    param (
        [string]$RepoPath
    )
    # Modify build-win.ps1 to use Release.static target instead of Release.vc14x.MT-sqlite.
    # This is unfortunate, but the build script does not take parameters for this setting, if we specify libTypes to lib it forces us for MT-sqlite
    $filePath = "$RepoPath\build-win.ps1"
    $oldText = '".vc14x.MT-sqlite"'
    $newText = '".static"'

    # Read, replace, and save the file
    (Get-Content $filePath) -replace $oldText, $newText | Set-Content $filePath
}

Which is fine, but sending this PR aiming to allow that option as well. Default remains true to not modify current behavior.

Comment thread build-win.ps1 Outdated
@lucianopa-msft

Copy link
Copy Markdown
Member Author

cc Tom Tan (@ThomsonTan)

Comment thread build-win.ps1
if ($libMTSqlite -eq "true") {
$actualConfig += ".vc14x.MT-sqlite"
} else {
$actualConfig += ".static"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because static libs are only supported for x86/x64, should a check be added here to do the guard?

@lucianopa-msft Luciano Almeida (lucianopa-msft) Feb 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is already a check bellow on line 83

if ($binType -eq "lib" -and ($actualArch -eq "ARM")) {

that will skip building static lib anyways for arm.
It could be done earlier, but checking here would be redundant

@ThomsonTan
Tom Tan (ThomsonTan) merged commit 1d6f48f into microsoft:main Feb 6, 2026
15 of 27 checks passed
@lucianopa-msft
Luciano Almeida (lucianopa-msft) deleted the lucianopa/build-win-fix branch February 6, 2026 21:20
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.

2 participants