Don't iterate over an array with only one element
This commit is contained in:
24
make.ps1
24
make.ps1
@@ -195,21 +195,19 @@ function Docs-Command
|
|||||||
|
|
||||||
function FindMSBuild
|
function FindMSBuild
|
||||||
{
|
{
|
||||||
$msBuildVersions = @("4.0")
|
$key = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"
|
||||||
foreach ($msBuildVersion in $msBuildVersions)
|
$property = Get-ItemProperty $key -ErrorAction SilentlyContinue
|
||||||
|
if ($property -eq $null -or $property.MSBuildToolsPath -eq $null)
|
||||||
{
|
{
|
||||||
$key = "HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\{0}" -f $msBuildVersion
|
return $null
|
||||||
$property = Get-ItemProperty $key -ErrorAction SilentlyContinue
|
|
||||||
if ($property -eq $null -or $property.MSBuildToolsPath -eq $null)
|
|
||||||
{
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
$path = Join-Path $property.MSBuildToolsPath -ChildPath "MSBuild.exe"
|
|
||||||
if (Test-Path $path)
|
|
||||||
{
|
|
||||||
return $path
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$path = Join-Path $property.MSBuildToolsPath -ChildPath "MSBuild.exe"
|
||||||
|
if (Test-Path $path)
|
||||||
|
{
|
||||||
|
return $path
|
||||||
|
}
|
||||||
|
|
||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user