@@ -1659,6 +1659,7 @@ function New-ILNugetPackage
16591659 }
16601660
16611661 $fileList = @ (
1662+ " Microsoft.Management.Infrastructure.CimCmdlets.dll" ,
16621663 " Microsoft.PowerShell.Commands.Diagnostics.dll" ,
16631664 " Microsoft.PowerShell.Commands.Management.dll" ,
16641665 " Microsoft.PowerShell.Commands.Utility.dll" ,
@@ -1672,14 +1673,14 @@ function New-ILNugetPackage
16721673 " Microsoft.PowerShell.MarkdownRender.dll" )
16731674
16741675 $linuxExceptionList = @ (
1676+ " Microsoft.Management.Infrastructure.CimCmdlets.dll" ,
16751677 " Microsoft.PowerShell.Commands.Diagnostics.dll" ,
16761678 " Microsoft.PowerShell.CoreCLR.Eventing.dll" ,
16771679 " Microsoft.WSMan.Management.dll" ,
16781680 " Microsoft.WSMan.Runtime.dll" )
16791681
16801682 if ($PSCmdlet.ShouldProcess (" Create nuget packages at: $PackagePath " ))
16811683 {
1682-
16831684 $refBinPath = New-TempFolder
16841685 $SnkFilePath = " $RepoRoot \src\signing\visualstudiopublic.snk"
16851686
@@ -1715,13 +1716,54 @@ function New-ILNugetPackage
17151716 $contentFolder = New-Item (Join-Path $filePackageFolder " contentFiles\any\any" ) - ItemType Directory - Force
17161717 $dotnetRefAsmFolder = Join-Path - Path $WinFxdBinPath - ChildPath " ref"
17171718 Copy-Item - Path $dotnetRefAsmFolder - Destination $contentFolder - Recurse - Force
1719+ Write-Log " Copied the reference assembly folder to contentFiles for the SDK package"
1720+
1721+ # Copy the built-in module folders to the NuGet package, so 'dotnet publish' can deploy those modules to the $pshome module path.
1722+ # This is for enabling applications that hosts PowerShell to ship the built-in modules.
1723+
1724+ $winBuiltInModules = @ (
1725+ " CimCmdlets" ,
1726+ " Microsoft.PowerShell.Diagnostics" ,
1727+ " Microsoft.PowerShell.Host" ,
1728+ " Microsoft.PowerShell.Management" ,
1729+ " Microsoft.PowerShell.Security" ,
1730+ " Microsoft.PowerShell.Utility" ,
1731+ " Microsoft.WSMan.Management" ,
1732+ " PSDiagnostics"
1733+ )
1734+
1735+ $unixBuiltInModules = @ (
1736+ " Microsoft.PowerShell.Host" ,
1737+ " Microsoft.PowerShell.Management" ,
1738+ " Microsoft.PowerShell.Security" ,
1739+ " Microsoft.PowerShell.Utility"
1740+ )
1741+
1742+ $winModuleFolder = New-Item (Join-Path $contentFolder " runtimes\win\lib\netcoreapp3.1\Modules" ) - ItemType Directory - Force
1743+ $unixModuleFolder = New-Item (Join-Path $contentFolder " runtimes\unix\lib\netcoreapp3.1\Modules" ) - ItemType Directory - Force
1744+
1745+ foreach ($module in $winBuiltInModules ) {
1746+ $source = Join-Path $WinFxdBinPath " Modules\$module "
1747+ Copy-Item - Path $source - Destination $winModuleFolder - Recurse - Force
1748+ }
1749+
1750+ foreach ($module in $unixBuiltInModules ) {
1751+ $source = Join-Path $LinuxFxdBinPath " Modules\$module "
1752+ Copy-Item - Path $source - Destination $unixModuleFolder - Recurse - Force
1753+ }
1754+
1755+ Write-Log " Copied the built-in modules to contentFiles for the SDK package"
17181756 }
17191757
17201758 # region nuspec
17211759 # filed a tracking bug for automating generation of dependecy list: https://github.com/PowerShell/PowerShell/issues/6247
17221760 $deps = [System.Collections.ArrayList ]::new()
17231761
17241762 switch ($fileBaseName ) {
1763+ ' Microsoft.Management.Infrastructure.CimCmdlets' {
1764+ $deps.Add ([tuple ]::Create([tuple ]::Create(' id' , ' System.Management.Automation' ), [tuple ]::Create(' version' , $PackageVersion ))) > $null
1765+ }
1766+
17251767 ' Microsoft.PowerShell.Commands.Diagnostics' {
17261768 $deps.Add ([tuple ]::Create([tuple ]::Create(' id' , ' System.Management.Automation' ), [tuple ]::Create(' version' , $PackageVersion ))) > $null
17271769 }
@@ -1771,6 +1813,7 @@ function New-ILNugetPackage
17711813 }
17721814 $deps.Add ([tuple ]::Create([tuple ]::Create(' id' , ' Microsoft.WSMan.Management' ), [tuple ]::Create(' version' , $PackageVersion ))) > $null
17731815 $deps.Add ([tuple ]::Create([tuple ]::Create(' id' , ' Microsoft.PowerShell.Commands.Diagnostics' ), [tuple ]::Create(' version' , $PackageVersion ))) > $null
1816+ $deps.Add ([tuple ]::Create([tuple ]::Create(' id' , ' Microsoft.Management.Infrastructure.CimCmdlets' ), [tuple ]::Create(' version' , $PackageVersion ))) > $null
17741817 }
17751818
17761819 ' Microsoft.PowerShell.Security' {
0 commit comments