Skip to content

Instantly share code, notes, and snippets.

@StarJade-Park
Created December 21, 2022 06:14
Show Gist options
  • Save StarJade-Park/9313eaab4ed380dd49362503a445b951 to your computer and use it in GitHub Desktop.
Save StarJade-Park/9313eaab4ed380dd49362503a445b951 to your computer and use it in GitHub Desktop.
# Build a Visual Studio C++ project
# VS2022 Community, x64, release
# Check that a path to a .vcxproj file was provided
if ($args.Length -eq 0) {
Write-Output "No project file specified"
exit 1
}
# Set the path to the .vcxproj file
$projectFile = $args[0]
# Set the path to the msbuild.exe executable
$msbuildExe = "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe"
# Build the project using msbuild
& $msbuildExe $projectFile /t:Build /p:Platform='x64' /p:Configuration=Release
# Check the exit code of the build to determine success or failure
if ($LASTEXITCODE -ne 0) {
Write-Output "Build failed"
exit $LASTEXITCODE
}
Write-Output "Build succeeded"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment