Skip to content

Commit 2051c5f

Browse files
authored
Stop referencing Microsoft.PowerShell.Security when the core snapin is used (PowerShell#17771)
1 parent f2204a0 commit 2051c5f

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@{
2-
GUID="A94C8C7E-9810-47C0-B8AF-65089C13A35A"
3-
Author="PowerShell"
4-
CompanyName="Microsoft Corporation"
5-
Copyright="Copyright (c) Microsoft Corporation."
6-
ModuleVersion="7.0.0.0"
2+
GUID = "A94C8C7E-9810-47C0-B8AF-65089C13A35A"
3+
Author = "PowerShell"
4+
CompanyName = "Microsoft Corporation"
5+
Copyright = "Copyright (c) Microsoft Corporation."
6+
ModuleVersion = "7.0.0.0"
77
CompatiblePSEditions = @("Core")
8-
PowerShellVersion="3.0"
8+
PowerShellVersion = "3.0"
99
FunctionsToExport = @()
10-
CmdletsToExport="Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-PfxCertificate" , "Protect-CmsMessage", "Unprotect-CmsMessage", "Get-CmsMessage"
10+
CmdletsToExport = "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-PfxCertificate" , "Protect-CmsMessage", "Unprotect-CmsMessage", "Get-CmsMessage"
1111
AliasesToExport = @()
12-
NestedModules="Microsoft.PowerShell.Security.dll"
12+
NestedModules = "Microsoft.PowerShell.Security.dll"
1313
HelpInfoURI = 'https://aka.ms/powershell73-help'
1414
}
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
@{
2-
GUID="A94C8C7E-9810-47C0-B8AF-65089C13A35A"
3-
Author="PowerShell"
4-
CompanyName="Microsoft Corporation"
5-
Copyright="Copyright (c) Microsoft Corporation."
6-
ModuleVersion="7.0.0.0"
2+
GUID = "A94C8C7E-9810-47C0-B8AF-65089C13A35A"
3+
Author = "PowerShell"
4+
CompanyName = "Microsoft Corporation"
5+
Copyright = "Copyright (c) Microsoft Corporation."
6+
ModuleVersion = "7.0.0.0"
77
CompatiblePSEditions = @("Core")
8-
PowerShellVersion="3.0"
8+
PowerShellVersion = "3.0"
99
FunctionsToExport = @()
10-
CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog"
10+
CmdletsToExport = "Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog"
1111
AliasesToExport = @()
12-
NestedModules="Microsoft.PowerShell.Security.dll"
13-
TypesToProcess="Security.types.ps1xml"
12+
NestedModules = "Microsoft.PowerShell.Security.dll"
13+
# 'Security.types.ps1xml' refers to types from 'Microsoft.PowerShell.Security.dll' and thus requiring to load the assembly before processing the type file.
14+
# We declare 'Microsoft.PowerShell.Security.dll' in 'RequiredAssemblies' so as to make sure it's loaded before the type file processing.
15+
RequiredAssemblies = "Microsoft.PowerShell.Security.dll"
16+
TypesToProcess = "Security.types.ps1xml"
1417
HelpInfoURI = 'https://aka.ms/powershell73-help'
1518
}

src/System.Management.Automation/engine/InitialSessionState.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3851,13 +3851,6 @@ internal PSSnapInInfo ImportPSSnapIn(PSSnapInInfo psSnapInInfo, out PSSnapInExce
38513851
assemblyEntry.SetPSSnapIn(psSnapInInfo);
38523852
Assemblies.Add(assemblyEntry);
38533853

3854-
// entry from types.ps1xml references a type (Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase) in this assembly
3855-
if (psSnapInInfo.Name.Equals(CoreSnapin, StringComparison.OrdinalIgnoreCase))
3856-
{
3857-
assemblyEntry = new SessionStateAssemblyEntry("Microsoft.PowerShell.Security", null);
3858-
this.Assemblies.Add(assemblyEntry);
3859-
}
3860-
38613854
if (cmdlets != null)
38623855
{
38633856
foreach (SessionStateCmdletEntry cmdlet in cmdlets.Values)

test/powershell/Host/Startup.Tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Describe "Validate start of console host" -Tag CI {
77
'Microsoft.ApplicationInsights.dll'
88
'Microsoft.Management.Infrastructure.dll'
99
'Microsoft.PowerShell.ConsoleHost.dll'
10-
'Microsoft.PowerShell.Security.dll'
1110
'Microsoft.Win32.Primitives.dll'
1211
'Microsoft.Win32.Registry.dll'
1312
'netstandard.dll'

0 commit comments

Comments
 (0)