From f0e64c2c6c6d6c9b47f4df9ba7cdab98363ee38d Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 21 Jul 2016 14:08:29 -0700 Subject: [PATCH] Clean up ApplicationBase work-around --- .../engine/Utils.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 3309572433..ea1fbc3c51 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -231,15 +231,18 @@ namespace System.Management.Automation /// internal static string GetApplicationBase(string shellId) { - if (!Platform.IsCore) + // TODO: #1184 will resolve this work-around + // The application base cannot be resolved from the registry for side-by-side versions + // of PowerShell. +#if !CORECLR + // try to get the path from the registry first + string result = GetApplicationBaseFromRegistry(shellId); + if (result != null) { - // try to get the path from the registry first - string result = GetApplicationBaseFromRegistry(shellId); - if (result != null) - { - return result; - } + return result; } +#endif + #if CORECLR // Use the location of SMA.dll as the application base // Assembly.GetEntryAssembly is not in CoreCLR. GAC is not in CoreCLR.