Skip to content

Commit fcab671

Browse files
committed
Attempt to reload and catch
1 parent 470906b commit fcab671

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

PSCompatibilityCollector/PSCompatibilityCollector.psm1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
# Licensed under the MIT License.
33

44
# Add the relevant binary module
5-
if ($PSVersionTable.PSVersion.Major -ge 6)
5+
try
66
{
7-
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
7+
if ($PSVersionTable.PSVersion.Major -ge 6)
8+
{
9+
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
10+
}
11+
else
12+
{
13+
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
14+
}
815
}
9-
else
16+
catch
1017
{
11-
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
18+
# Do nothing
1219
}

0 commit comments

Comments
 (0)