Skip to content

Commit e1dd99c

Browse files
authored
Merge pull request #3131 from AArnott/dirFlexBuild
Fix up build.ps1 to allow running from any directory
2 parents b6b9b02 + edbd24d commit e1dd99c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

build/build.ps1

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ param (
77
)
88

99
# build the solution
10-
$SolutionPath = "..\StyleCopAnalyzers.sln"
11-
12-
# make sure the script was run from the expected path
13-
if (!(Test-Path $SolutionPath)) {
14-
$host.ui.WriteErrorLine('The script was run from an invalid working directory.')
15-
exit 1
16-
}
10+
$SolutionPath = Resolve-Path "$PSScriptRoot\..\StyleCopAnalyzers.sln"
1711

1812
If ($Debug) {
1913
$BuildConfig = 'Debug'
@@ -22,10 +16,11 @@ If ($Debug) {
2216
}
2317

2418
# download nuget.exe if necessary
25-
$nuget = '..\.nuget\nuget.exe'
19+
$nugetDir = "$PSScriptRoot\..\.nuget"
20+
$nuget = "$nugetDir\nuget.exe"
2621
If (-not (Test-Path $nuget)) {
27-
If (-not (Test-Path '..\.nuget')) {
28-
mkdir '..\.nuget'
22+
If (-not (Test-Path $nugetDir)) {
23+
mkdir $nugetDir
2924
}
3025

3126
$nugetSource = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'

0 commit comments

Comments
 (0)