From 53a212ee65656ac1e562dfffc1b83204d871a45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadas=20Medi=C5=A1auskas?= Date: Mon, 8 Aug 2022 18:18:51 +0100 Subject: [PATCH] Make generated implicit remoting modules backwards compatible with PowerShell 5 (#17227) * Fix implicit remoting generator version check * Fix implicit remoting generator version check --- .../commands/utility/ImplicitRemotingCommands.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs index 7190c16cad..f0044dd188 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs @@ -2100,7 +2100,9 @@ $script:MyModule = $MyInvocation.MyCommand.ScriptBlock.Module // In Win8, we are no longer loading all assemblies by default. // So we need to use the fully qualified name when accessing a type in that assembly - string versionOfScriptGenerator = "[" + typeof(ExportPSSessionCommand).AssemblyQualifiedName + "]" + "::VersionOfScriptGenerator"; + Type type = typeof(ExportPSSessionCommand); + string asmName = type.Assembly.GetName().Name; + string versionOfScriptGenerator = $"[{type.FullName}, {asmName}]::VersionOfScriptGenerator"; GenerateTopComment(writer); writer.Write( HeaderTemplate,