Browse Source

Fix PowerShell detection error when registry key does not exist.

pull/15/head
mrward 14 years ago
parent
commit
507a8a6dc9
  1. 7
      src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs

7
src/AddIns/Misc/PackageManagement/Project/Src/Scripting/PowerShellDetection.cs

@ -19,19 +19,20 @@ namespace ICSharpCode.PackageManagement.Scripting @@ -19,19 +19,20 @@ namespace ICSharpCode.PackageManagement.Scripting
public bool IsPowerShell2Installed()
{
if (!installed.HasValue) {
CheckIfPowerShell2IsInstalled();
installed = CheckIfPowerShell2IsInstalled();
}
return installed.Value;
}
void CheckIfPowerShell2IsInstalled()
bool CheckIfPowerShell2IsInstalled()
{
RegistryKey key = OpenPowerShellRegistryKey();
if (key != null) {
using (key) {
installed = IsPowerShell2Installed(key);
return IsPowerShell2Installed(key);
}
}
return false;
}
RegistryKey OpenPowerShellRegistryKey()

Loading…
Cancel
Save