Last active
August 12, 2020 18:28
-
-
Save heiswayi/7cd7c2b35215905531557444ad953eb1 to your computer and use it in GitHub Desktop.
MSBuild PowerShell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# msbuild.ps1 | |
[CmdletBinding(PositionalBinding = $false)] | |
param ( | |
[ValidateSet('Build', 'Clean', 'Rebuild')] | |
[string] | |
$Target = 'Build', | |
[ValidateSet('Release', 'Debug')] | |
[string] | |
$Configuration = 'Release', | |
[ValidateSet('Mixed Platforms', 'Any CPU', 'x64', 'x86')] | |
[string] $Platform = 'Mixed Platforms', | |
[Parameter(ValueFromRemainingArguments = $true)] | |
[Alias('Args')] | |
[string[]] $ArgumentList | |
) | |
$MSBuildCmd = $( | |
Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 | | |
Select-Object -ExpandProperty MSBuildToolsPath | | |
Join-Path -ChildPath MSBuild.exe | |
) | |
$MSBuildArgs = @( | |
, '/fl' | |
, '/flp:PerformanceSummary;Verbosity=normal' | |
, '/v:normal' | |
, '/tv:4.0' | |
, "/p:Configuration=${Configuration}" | |
, "/p:Platform=${Platform}" | |
, "/t:${Target}" | |
) | |
& $MSBuildCmd $MSBuildArgs $ArgumentList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment