@@ -249,10 +249,15 @@ Task -Name __InstallChocolatey -Description $private -Action {
249
249
if (isChocolateyInstalled) {
250
250
Write-Output " Chocolatey already installed" ;
251
251
Write-Output " Updating to latest Chocolatey..."
252
- $choco = Join-Path $script :chocolateyDir - ChildPath " choco.exe" ;
252
+
253
+ if (Test-Path - Path (Join-Path - Path $script :chocolateyDir - ChildPath " choco.exe" )) {
254
+ $script :chocolateyCommand = Join-Path $script :chocolateyDir - ChildPath " choco.exe"
255
+ } else {
256
+ $script :chocolateyCommand = Join-Path (Join-Path $script :chocolateyDir " chocolateyInstall" ) - ChildPath " chocolatey.cmd" ;
257
+ }
253
258
254
259
exec {
255
- Invoke-Expression " $choco upgrade chocolatey" ;
260
+ Invoke-Expression " $script :chocolateyCommand upgrade chocolatey" ;
256
261
}
257
262
258
263
Write-Output " Latest Chocolatey installed."
@@ -281,14 +286,13 @@ Task -Name __InstallChocolatey -Description $private -Action {
281
286
Task - Name __InstallReSharperCommandLineTools - Depends __InstallChocolatey - Description $private - Action {
282
287
$chocolateyBinDir = Join-Path $script :chocolateyDir - ChildPath " bin" ;
283
288
$inspectCodeExe = Join-Path $chocolateyBinDir - ChildPath " inspectcode.exe" ;
284
- $choco = Join-Path $script :chocolateyDir - ChildPath " choco.exe" ;
285
289
286
290
try {
287
291
Write-Output " Running Install Command Line Tools..."
288
292
289
293
if (-not (Test-Path $inspectCodeExe )) {
290
294
exec {
291
- Invoke-Expression " $choco install resharper-clt -y" ;
295
+ Invoke-Expression " $script :chocolateyCommand install resharper-clt -y" ;
292
296
}
293
297
} else {
294
298
Write-Output " resharper-clt already installed" ;
@@ -303,13 +307,11 @@ Task -Name __InstallReSharperCommandLineTools -Depends __InstallChocolatey -Desc
303
307
}
304
308
305
309
Task - Name __UpdateReSharperCommandLineTools - Description $private - Action {
306
- $choco = Join-Path $script :chocolateyDir - ChildPath " choco.exe" ;
307
-
308
310
try {
309
311
Write-Output " Running Upgrade Command Line Tools..."
310
312
311
313
exec {
312
- Invoke-Expression " $choco upgrade resharper-clt" ;
314
+ Invoke-Expression " $script :chocolateyCommand upgrade resharper-clt" ;
313
315
}
314
316
315
317
Write-Output (" ************ Upgrade Command Line Tools Successful ************" )
@@ -345,14 +347,13 @@ Task -Name __InstallPSBuild -Description $private -Action {
345
347
Task - Name __InstallGitVersion - Depends __InstallChocolatey - Description $private - Action {
346
348
$chocolateyBinDir = Join-Path $script :chocolateyDir - ChildPath " bin" ;
347
349
$gitVersionExe = Join-Path $chocolateyBinDir - ChildPath " GitVersion.exe" ;
348
- $choco = Join-Path $script :chocolateyDir - ChildPath " choco.exe" ;
349
350
350
351
try {
351
352
Write-Output " Running Install GitVersion.Portable..."
352
353
353
354
if (-not (Test-Path $gitVersionExe )) {
354
355
exec {
355
- Invoke-Expression " $choco install GitVersion.Portable -pre -y" ;
356
+ Invoke-Expression " $script :chocolateyCommand install GitVersion.Portable -pre -y" ;
356
357
}
357
358
} else {
358
359
Write-Output " GitVersion.Portable already installed" ;
@@ -367,13 +368,11 @@ Task -Name __InstallGitVersion -Depends __InstallChocolatey -Description $privat
367
368
}
368
369
369
370
Task - Name __UpdateGitVersion - Description $private - Action {
370
- $choco = Join-Path $script :chocolateyDir - ChildPath " choco.exe" ;
371
-
372
371
try {
373
372
Write-Output " Running Upgrade GitVersion.Portable..."
374
373
375
374
exec {
376
- Invoke-Expression " $choco upgrade GitVersion.Portable" ;
375
+ Invoke-Expression " $script :chocolateyCommand upgrade GitVersion.Portable" ;
377
376
}
378
377
379
378
Write-Output (" ************ Upgrade GitVersion.Portable Successful ************" )
0 commit comments