PowerShell-DevOps icon indicating copy to clipboard operation
PowerShell-DevOps copied to clipboard

- Fix $PSVersionTable.CLRVersion since it's deprecated in PS Core -> …

Open linuxcrash opened this issue 4 years ago • 1 comments
trafficstars

  • Fix $PSVersionTable.CLRVersion since it's deprecated in PS Core -> https://github.com/PowerShell/PowerShell/issues/1395

Description

Import-Module fails on PS Core since there is no $PSVersionTable:CLRVersion. This is deprecated.

Related Issue

https://github.com/PowerShell/PowerShell/issues/1395

Motivation and Context

This fix will default $CLRVersion to 'Unknown' and only set it to a Version if it's available in $PSVersionTable.

How Has This Been Tested?

Local execution in PowerShell Core.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

linuxcrash avatar Aug 02 '21 18:08 linuxcrash

@MathieuBuisson the build failed due to issues of Merge-DscConfigData which was not touched/changed in this PR.

linuxcrash avatar Aug 03 '21 06:08 linuxcrash