diff --git a/src/System.Management.Automation/resources/MshSnapInCmdletResources.resx b/src/System.Management.Automation/resources/MshSnapInCmdletResources.resx
index d23249ed109..225ef930619 100644
--- a/src/System.Management.Automation/resources/MshSnapInCmdletResources.resx
+++ b/src/System.Management.Automation/resources/MshSnapInCmdletResources.resx
@@ -129,7 +129,4 @@
Cannot add PowerShell snap-in {0} because it is a system PowerShell module. Use Import-Module to load the module.
-
- The custom PowerShell snap-in is not supported in PowerShell Core.
-
diff --git a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs
index b69ad68273b..514518be55f 100644
--- a/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs
+++ b/src/System.Management.Automation/singleshell/config/MshSnapinInfo.cs
@@ -3,16 +3,17 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using Microsoft.Win32;
-using System.Security;
+using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text;
-using System.Globalization;
-using Regex = System.Text.RegularExpressions.Regex;
+using System.Security;
-using Dbg = System.Management.Automation.Diagnostics;
using Microsoft.PowerShell.Commands;
+using Microsoft.Win32;
+
+using Dbg = System.Management.Automation.Diagnostics;
+using Regex = System.Text.RegularExpressions.Regex;
namespace System.Management.Automation
{
@@ -50,7 +51,6 @@ internal static class RegistryStrings
internal const string MshSnapin_AssemblyName = "AssemblyName";
internal const string MshSnapin_ModuleName = "ModuleName";
internal const string MshSnapin_MonadVersion = "PowerShellVersion";
- internal const string MshSnapin_CustomPSSnapInType = "CustomPSSnapInType";
internal const string MshSnapin_BuiltInTypes = "Types";
internal const string MshSnapin_BuiltInFormats = "Formats";
internal const string MshSnapin_Description = "Description";
@@ -85,8 +85,7 @@ internal PSSnapInInfo
Collection types,
Collection formats,
string descriptionFallback,
- string vendorFallback,
- string customPSSnapInType
+ string vendorFallback
)
{
if (string.IsNullOrEmpty(name))
@@ -114,16 +113,6 @@ string customPSSnapInType
throw PSTraceSource.NewArgumentNullException("psVersion");
}
-#if CORECLR // CustomPSSnapIn Not Supported On CSS.
- // CustomPSSnapIn derives from System.Configuration.Install, which is not in CoreCLR.
- if (customPSSnapInType != null)
- {
- throw PSTraceSource.NewArgumentException(
- "customPSSnapInType",
- MshSnapInCmdletResources.CustomPSSnapInNotSupportedInPowerShellCore);
- }
-#endif
-
if (version == null)
{
version = new Version("0.0");
@@ -158,7 +147,6 @@ string customPSSnapInType
Version = version;
Types = types;
Formats = formats;
- CustomPSSnapInType = customPSSnapInType;
_descriptionFallback = descriptionFallback;
_vendorFallback = vendorFallback;
}
@@ -177,10 +165,9 @@ internal PSSnapInInfo
string description,
string descriptionFallback,
string vendor,
- string vendorFallback,
- string customPSSnapInType
+ string vendorFallback
)
- : this(name, isDefault, applicationBase, assemblyName, moduleName, psVersion, version, types, formats, descriptionFallback, vendorFallback, customPSSnapInType)
+ : this(name, isDefault, applicationBase, assemblyName, moduleName, psVersion, version, types, formats, descriptionFallback, vendorFallback)
{
_description = description;
_vendor = vendor;
@@ -202,9 +189,8 @@ internal PSSnapInInfo
string descriptionIndirect,
string vendor,
string vendorFallback,
- string vendorIndirect,
- string customPSSnapInType
- ) : this(name, isDefault, applicationBase, assemblyName, moduleName, psVersion, version, types, formats, description, descriptionFallback, vendor, vendorFallback, customPSSnapInType)
+ string vendorIndirect
+ ) : this(name, isDefault, applicationBase, assemblyName, moduleName, psVersion, version, types, formats, description, descriptionFallback, vendor, vendorFallback)
{
// add descriptionIndirect and vendorIndirect only if the mshsnapin is a default mshsnapin
if (isDefault)
@@ -256,11 +242,6 @@ internal string AbsoluteModulePath
}
}
- ///
- /// Type of custom mshsnapin.
- ///
- internal string CustomPSSnapInType { get; }
-
///
/// Monad version used by mshsnapin
///
@@ -414,13 +395,22 @@ internal void LoadIndirectResources(RegistryStringResourceIndirect resourceReade
internal PSSnapInInfo Clone()
{
- PSSnapInInfo cloned = new PSSnapInInfo(Name,
- IsDefault, ApplicationBase, AssemblyName,
- ModuleName, PSVersion, Version, new Collection(Types),
- new Collection(Formats), _description,
- _descriptionFallback, _descriptionIndirect, _vendor, _vendorFallback, _vendorIndirect,
- CustomPSSnapInType
- );
+ PSSnapInInfo cloned = new PSSnapInInfo(
+ Name,
+ IsDefault,
+ ApplicationBase,
+ AssemblyName,
+ ModuleName,
+ PSVersion,
+ Version,
+ new Collection(Types),
+ new Collection(Formats),
+ _description,
+ _descriptionFallback,
+ _descriptionIndirect,
+ _vendor,
+ _vendorFallback,
+ _vendorIndirect);
return cloned;
}
@@ -728,17 +718,11 @@ private static PSSnapInInfo ReadOne(RegistryKey mshSnapInRoot, string mshsnapinI
logPipelineExecutionDetails = true;
}
- string customPSSnapInType = ReadStringValue(mshsnapinKey, RegistryStrings.MshSnapin_CustomPSSnapInType, false);
- if (string.IsNullOrEmpty(customPSSnapInType))
- {
- customPSSnapInType = null;
- }
-
Collection types = ReadMultiStringValue(mshsnapinKey, RegistryStrings.MshSnapin_BuiltInTypes, false);
Collection formats = ReadMultiStringValue(mshsnapinKey, RegistryStrings.MshSnapin_BuiltInFormats, false);
s_mshsnapinTracer.WriteLine("Successfully read registry values for mshsnapin {0}. Constructing PSSnapInInfo object.", mshsnapinId);
- PSSnapInInfo mshSnapinInfo = new PSSnapInInfo(mshsnapinId, false, applicationBase, assemblyName, moduleName, monadVersion, version, types, formats, description, vendor, customPSSnapInType);
+ PSSnapInInfo mshSnapinInfo = new PSSnapInInfo(mshsnapinId, false, applicationBase, assemblyName, moduleName, monadVersion, version, types, formats, description, vendor);
mshSnapinInfo.LogPipelineExecutionDetails = logPipelineExecutionDetails;
return mshSnapinInfo;
@@ -963,10 +947,22 @@ internal static PSSnapInInfo ReadCoreEngineSnapIn()
string moduleName = Path.Combine(applicationBase, s_coreSnapin.AssemblyName + ".dll");
- PSSnapInInfo coreMshSnapin = new PSSnapInInfo(s_coreSnapin.PSSnapInName, true, applicationBase,
- strongName, moduleName, psVersion, assemblyVersion, types, formats, null,
- s_coreSnapin.Description, s_coreSnapin.DescriptionIndirect, null, null,
- s_coreSnapin.VendorIndirect, null);
+ PSSnapInInfo coreMshSnapin = new PSSnapInInfo(
+ s_coreSnapin.PSSnapInName,
+ isDefault: true,
+ applicationBase,
+ strongName,
+ moduleName,
+ psVersion,
+ assemblyVersion,
+ types,
+ formats,
+ description: null,
+ s_coreSnapin.Description,
+ s_coreSnapin.DescriptionIndirect,
+ vendor: null,
+ vendorFallback: null,
+ s_coreSnapin.VendorIndirect);
#if !UNIX
// NOTE: On Unix, logging has to be deferred until after command-line parsing
// complete. On Windows, deferring the call is not needed
@@ -1040,10 +1036,22 @@ internal static Collection ReadEnginePSSnapIns()
moduleName = defaultMshSnapinInfo.AssemblyName;
}
- PSSnapInInfo defaultMshSnapin = new PSSnapInInfo(defaultMshSnapinInfo.PSSnapInName, true, applicationBase,
- strongName, moduleName, psVersion, assemblyVersion, types, formats, null,
- defaultMshSnapinInfo.Description, defaultMshSnapinInfo.DescriptionIndirect, null, null,
- defaultMshSnapinInfo.VendorIndirect, null);
+ PSSnapInInfo defaultMshSnapin = new PSSnapInInfo(
+ defaultMshSnapinInfo.PSSnapInName,
+ isDefault: true,
+ applicationBase,
+ strongName,
+ moduleName,
+ psVersion,
+ assemblyVersion,
+ types,
+ formats,
+ description: null,
+ defaultMshSnapinInfo.Description,
+ defaultMshSnapinInfo.DescriptionIndirect,
+ vendor: null,
+ vendorFallback: null,
+ defaultMshSnapinInfo.VendorIndirect);
SetSnapInLoggingInformation(defaultMshSnapin);
engineMshSnapins.Add(defaultMshSnapin);