Set remoting PSVersionTable private data in a downlevel compatible manner
This commit is contained in:
parent
2b74b89f76
commit
2b70837d98
|
@ -81,6 +81,14 @@ namespace System.Management.Automation
|
|||
return s_psVersionTable;
|
||||
}
|
||||
|
||||
internal static Hashtable GetPSVersionTableForDownLevel()
|
||||
{
|
||||
var result = (Hashtable)s_psVersionTable.Clone();
|
||||
// Downlevel systems don't support SemanticVersion, but Version is most likely good enough anyway.
|
||||
result[PSVersionInfo.PSVersionName] = (Version)(SemanticVersion)s_psVersionTable[PSVersionInfo.PSVersionName];
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static Version GetBuildVersion()
|
||||
{
|
||||
string assemblyPath = typeof(PSVersionInfo).GetTypeInfo().Assembly.Location;
|
||||
|
|
|
@ -6438,7 +6438,10 @@ namespace System.Management.Automation
|
|||
{
|
||||
result = new PSPrimitiveDictionary();
|
||||
}
|
||||
PSPrimitiveDictionary versionTable = new PSPrimitiveDictionary(PSVersionInfo.GetPSVersionTable());
|
||||
PSPrimitiveDictionary versionTable = new PSPrimitiveDictionary(PSVersionInfo.GetPSVersionTableForDownLevel())
|
||||
{
|
||||
{"PSSemanticVersion", PSVersionInfo.PSVersion.ToString()}
|
||||
};
|
||||
result.Add(PSVersionInfo.PSVersionTableName, versionTable);
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue