File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,8 +46,11 @@ if ($Clean) {
4646# install docfx tool
4747$PreviousLocation = Get-Location
4848Set-Location $RepoRoot
49- dotnet tool restore
50- Set-Location $PreviousLocation
49+ try {
50+ dotnet tool restore
51+ } finally {
52+ Set-Location $PreviousLocation
53+ }
5154
5255# delete anything that already exists
5356if ($Clean ) {
@@ -62,14 +65,20 @@ $DocFxJson = Join-Path -Path $SiteFolder "docfx.json"
6265$DocFxLog = Join-Path - Path $SiteFolder " obj\docfx.log"
6366
6467if ($? ) {
65- if ($ServeDocs -eq $false ) {
66- # build the output
67- Write-Host " Building docs..."
68- & dotnet tool run docfx build $DocFxJson - l " $DocFxLog " -- logLevel $LogLevel
69- }
70- else {
71- # build + serve (for testing)
72- Write-Host " starting website..."
73- & dotnet tool run docfx $DocFxJson -- serve -- port $StagingPort
68+ $PreviousLocation = Get-Location
69+ Set-Location $RepoRoot
70+ try {
71+ if ($ServeDocs -eq $false ) {
72+ # build the output
73+ Write-Host " Building docs..."
74+ & dotnet tool run docfx build $DocFxJson - l " $DocFxLog " -- logLevel $LogLevel
75+ }
76+ else {
77+ # build + serve (for testing)
78+ Write-Host " starting website..."
79+ & dotnet tool run docfx $DocFxJson -- serve -- port $StagingPort
80+ }
81+ } finally {
82+ Set-Location $PreviousLocation
7483 }
7584}
You can’t perform that action at this time.
0 commit comments