Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

jobs:
build:
runs-on: windows-latest
runs-on: blacksmith-4vcpu-windows-2025
strategy:
matrix:
platform: [arm64, x64]
Expand Down
42 changes: 26 additions & 16 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
import sys
import shutil

PROGRAM_FILES = os.environ["ProgramFiles"]
VISUAL_STUDIO_INSTALLED_VERSION = 2022
VISUAL_STUDIO_INSTALLED_VARIANT = ["Community", "Professional", "Enterprise"]

MS_BUILD_PATH = '{}\\Microsoft Visual Studio\\{}\\{}\\MSBuild\\Current\\Bin\\MSBuild.exe'

for variant in VISUAL_STUDIO_INSTALLED_VARIANT:
if os.path.exists(
MS_BUILD_PATH.format(
PROGRAM_FILES, VISUAL_STUDIO_INSTALLED_VERSION, variant
)
):
MS_BUILD_PATH = MS_BUILD_PATH.format(
PROGRAM_FILES, VISUAL_STUDIO_INSTALLED_VERSION, variant
)
break
PROGRAM_FILES_DIRS = [
d for d in (
os.environ.get("ProgramFiles"),
os.environ.get("ProgramFiles(x86)"),
) if d
]
VISUAL_STUDIO_INSTALLED_VERSION = 2022
VISUAL_STUDIO_INSTALLED_VARIANT = ["Community", "Professional", "Enterprise", "BuildTools"]

MS_BUILD_PATH_TEMPLATE = '{}\\Microsoft Visual Studio\\{}\\{}\\MSBuild\\Current\\Bin\\MSBuild.exe'
MS_BUILD_PATH = None

for program_files in PROGRAM_FILES_DIRS:
for variant in VISUAL_STUDIO_INSTALLED_VARIANT:
candidate = MS_BUILD_PATH_TEMPLATE.format(
program_files, VISUAL_STUDIO_INSTALLED_VERSION, variant
)
if os.path.exists(candidate):
MS_BUILD_PATH = candidate
break
if MS_BUILD_PATH:
break

if not MS_BUILD_PATH:
# Fall back to MSBuild on PATH (e.g. added by microsoft/setup-msbuild).
MS_BUILD_PATH = shutil.which("MSBuild") or shutil.which("MSBuild.exe") or "MSBuild.exe"

PROJECT_SOLUTION_PATH = os.path.join(os.path.curdir, 'ArchWSL.sln')
MS_BUILD_TARGET = "Build"
Expand Down
Loading