Skip to content

Commit 9d975e8

Browse files
committed
wrapping dotnet in a try-catch block
1 parent 3240e90 commit 9d975e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dbops.psm1

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ Set-PSFConfig -FullName dbops.security.usecustomencryptionkey -Value ($PSVersion
173173
Set-PSFConfig -FullName dbops.rdbms.type -Value 'SqlServer' -Validation connectionType -Initialize -Description "Assumes a certain RDBMS as a default one for each command. SQLServer by default"
174174
Set-PSFConfig -FullName dbops.package.slim -Value $false -Validation bool -Initialize -Description "Decides whether to make the packages 'slim' and omit module files when creating the package. Default: `$false"
175175
Set-PSFConfig -FullName dbops.config.variabletoken -Value "\#\{(token)\}" -Validation tokenRegex -Initialize -Description "Variable replacement token. Regex string that will be replaced with values from -Variables parameters. Default: \#\{(token)\}"
176-
Set-PSFConfig -FullName dbops.runtime.dotnetversion -Value ((dotnet --version) -as [version]) -Description "Current dotnet runtime." -Hidden
176+
$dotNet = try { dotnet --version } catch { $null }
177+
Set-PSFConfig -FullName dbops.runtime.dotnetversion -Value ($dotNet -as [version]) -Description "Current dotnet runtime." -Hidden
177178

178179
# extensions for SMO
179180
$typeData = Get-TypeData -TypeName 'Microsoft.SqlServer.Management.Smo.Database'

0 commit comments

Comments
 (0)