最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powershell - Converting a script module to a manifest one. But each file doesn't have access to each cmdlet without expo

programmeradmin1浏览0评论

In the script module, with 98 ps1 filles. Each file had access to each cmdlet from each file without needing to explicitly export them.

But in the manifest module, only the cmdlets that have been explicitly exported in psd1 file can be accessed by each file. I renamed the files to psm1 and declared them in NestedModules

There are way too many cmdlets to export them all, especially if there is no external need.

How to get the same behavior in a manifested module?

In the script module, with 98 ps1 filles. Each file had access to each cmdlet from each file without needing to explicitly export them.

But in the manifest module, only the cmdlets that have been explicitly exported in psd1 file can be accessed by each file. I renamed the files to psm1 and declared them in NestedModules

There are way too many cmdlets to export them all, especially if there is no external need.

How to get the same behavior in a manifested module?

Share Improve this question asked Mar 28 at 19:34 deetledeetle 4312 silver badges13 bronze badges 2
  • ... not completely sure if I got what meant ... but you may use Get-ChildItem $psscriptroot\*.ps1 | ForEach-Object { . $_.FullName }; Export-ModuleMember -Function * -Alias * inside your *psm1 file and FunctionsToExport = '*' inside your *psd1 file. This way you include all single *.ps1 script files in you module and export all functions included in these script files.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论