Permalink
Browse files

Merge pull request #5068 from sqlcollaborative/noerror

Import error fix - test for existence first - #5056
  • Loading branch information...
potatoqualitee committed Feb 10, 2019
2 parents db1923a + 2018b9d commit 626d36ce18adb0814eb245c54987dce7bf5decca
Showing with 10 additions and 8 deletions.
  1. +10 −8 bin/library.ps1
@@ -65,25 +65,27 @@ if ($ImportLibrary) {
}
}
# Else we prioritize user convenience
else {
else {
try {
$sln = (Resolve-Path -Path "$libraryBase\projects\dbatools\dbatools.sln" -ErrorAction Stop)
$hasProject = Test-Path -Path $sln -ErrorAction Stop
if ((Test-Path -Path "$libraryBase/projects/dbatools/dbatools.sln")) {
$sln = (Resolve-Path -Path "$libraryBase\projects\dbatools\dbatools.sln" -ErrorAction Stop)
$hasProject = Test-Path -Path $sln -ErrorAction Stop
}
} catch {
$null = 1
}

if (-not $dll) {
$hasCompiledDll = $false
} else {
$hasCompiledDll = Test-Path -Path $dll -ErrorAction Stop
}

$reslibdll = Resolve-Path -Path "$libraryBase\dbatools.dll"

if ((-not $script:alwaysBuildLibrary) -and $hasCompiledDll -and ([System.Diagnostics.FileVersionInfo]::GetVersionInfo($reslibdll).FileVersion -eq $currentLibraryVersion)) {
$start = Get-Date

try {
$libraryBase = Resolve-Path -Path "$libraryBase\"
$script:DllRoot = Resolve-Path -Path $script:DllRoot
@@ -104,7 +106,7 @@ else {
throw "No valid dbatools library found! Check your module integrity"
}
}

#region PowerShell TypeData
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsException" -SerializationDepth 2 -ErrorAction Ignore
Update-TypeData -TypeName "Sqlcollaborative.Dbatools.dbaSystem.DbatoolsExceptionRecord" -SerializationDepth 2 -ErrorAction Ignore

0 comments on commit 626d36c

Please sign in to comment.