forked from indilo53/gta-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.ps1
34 lines (28 loc) · 1.15 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Param (
[string]$build= "Release"
)
Install-Module VSSetup -Scope CurrentUser -Force
function Find-MSBuild
{
Param
(
[bool] $allowPreviewVersions = $false
)
if ($allowPreviewVersions) {
$latestVsInstallationInfo = Get-VSSetupInstance -All -Prerelease | Sort-Object -Property InstallationVersion -Descending | Select-Object -First 1
} else {
$latestVsInstallationInfo = Get-VSSetupInstance -All | Sort-Object -Property InstallationVersion -Descending | Select-Object -First 1
}
Write-Host "Latest version installed is $($latestVsInstallationInfo.InstallationVersion)"
if ($latestVsInstallationInfo.InstallationVersion -like "15.*") {
$msbuildLocation = "$($latestVsInstallationInfo.InstallationPath)\MSBuild\15.0\Bin\msbuild.exe"
Write-Host "Located msbuild for Visual Studio 2017 in $msbuildLocation"
} else {
$msbuildLocation = "$($latestVsInstallationInfo.InstallationPath)\MSBuild\Current\Bin\msbuild.exe"
Write-Host "Located msbuild in $msbuildLocation"
}
return $msbuildLocation
}
$MSBuild = Find-MSBuild
& "$MSBuild" -t:restore
& "$MSBuild" Toolkit.sln /p:Configuration=$build