Skip to content

Commit b4bf48a

Browse files
committed
Avoid error when ps1 is invoked from another ps1
1 parent 7250cec commit b4bf48a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Nerdbank.GitVersioning.NuGet/tools/Get-CommitId.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Param(
2222
[string]$Version
2323
)
2424

25-
if (!$DependencyBasePath) { $DependencyBasePath = "$PSScriptRoot\..\build" }
25+
if (-not (Test-Path variable:global:DependencyBasePath) -or !$DependencyBasePath) { $DependencyBasePath = "$PSScriptRoot\..\build" }
2626
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\Validation.dll"))
2727
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\NerdBank.GitVersioning.dll"))
2828
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\LibGit2Sharp.dll"))

src/Nerdbank.GitVersioning.NuGet/tools/Get-Version.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Param(
1010
[string]$ProjectDirectory="."
1111
)
1212

13-
if (!$DependencyBasePath) { $DependencyBasePath = "$PSScriptRoot\..\build" }
13+
if (-not (Test-Path variable:global:DependencyBasePath) -or !$DependencyBasePath) { $DependencyBasePath = "$PSScriptRoot\..\build" }
1414
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\Validation.dll"))
1515
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\NerdBank.GitVersioning.dll"))
1616
$null = [Reflection.Assembly]::LoadFile((Resolve-Path "$DependencyBasePath\LibGit2Sharp.dll"))

0 commit comments

Comments
 (0)