Skip to content

Instantly share code, notes, and snippets.

@lpatalas
Created November 25, 2018 10:05
Show Gist options
  • Save lpatalas/914a9fcafa6810cf369b118f3533ac67 to your computer and use it in GitHub Desktop.
Save lpatalas/914a9fcafa6810cf369b118f3533ac67 to your computer and use it in GitHub Desktop.
Missing NestedModules after updating manifest
$originalManifestPath = Join-Path $PSScriptRoot 'Original.psd1'
$updatedManifestPath = Join-Path $PSScriptRoot 'Updated.psd1'
'function Get-Root { Write-Host "Root" }' | Set-Content -Path 'RootModule.psm1'
'function Get-Nested { Write-Host "Nested" }' | Set-Content -Path 'NestedModule.psm1'
New-ModuleManifest `
-Path $originalManifestPath `
-NestedModules @('NestedModule.psm1') `
-RootModule 'RootModule.psm1' `
-FunctionsToExport @('Get-Root', 'Get-Nested') `
-CmdletsToExport @() `
-VariablesToExport @() `
-AliasesToExport @()
Copy-Item `
-Path $originalManifestPath `
-Destination $updatedManifestPath `
-Force
Update-ModuleManifest `
-Path $updatedManifestPath
$originalManifest = Import-PowerShellDataFile -Path $originalManifestPath
$updatedManifest = Import-PowerShellDataFile -Path $updatedManifestPath
Write-Host 'Original:' $originalManifest.NestedModules
Write-Host 'Updated:' $updatedManifest.NestedModules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment