Module manifest documentation is out of date
This documentation is out of date. For example, FunctionsToExport is no longer of type string, but is a string[]. Could someone review this documentation and update it please. Thanks.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: e694cdf5-e73d-31f9-dcf4-6c8cc0a71157
- Version Independent ID: 0cf3a0ec-1549-7472-cfd8-243ec0f9c135
- Content: How to Write a PowerShell Module Manifest
- Content Source: developer/module/how-to-write-a-powershell-module-manifest.md
- Product: powershell
- Technology: powershell-developer
- GitHub Login: @joeyaiello
- Microsoft Alias: jaiello
Looking at updating this.
One thing I wouldn't mind a more seasoned opinion on...
The current doc lists certain attributes as "type: string", such as GUID and ModuleVersion, but PowerShell will attempt to cast these into [System.Guid] and [System.Version] when the module is imported.
While the manifest author will technically enter this information as a string, it seems a little misleading to label the attributes as such. Someone may attempt to enter values that can't be converted.
ModuleVersion = '1'
...for example.
Should the attributes instead be listed as the actual types that they're being converted to?
The types should be [string] types. That is what the cmdlets expect as input and that is what New-ModuleManifest creates.
Are you certain @sdwheeler ? I believe that when using Publish-Module it expects that type to be an array of strings. i.e. [string[]].
I should have said "string" types and not used the more specific syntax. So I meant [string] or [string[]] where appropriate.
Yeah, that makes sense. I still think the documentation could be updated to mention that. Right now the docs make it look like it only accepts a [string] and the example it uses is *, which is considered a bad practice. Instead it should show you how to specify two or more specific function names, as the best practice is to explicitly list out only the functions you want exported (rather than just exporting all of them with *). With the current docs, it doesn't mention how you would do that, and with it saying the type is a [string], I think most people would assume you do "function1, function2, function3", which is invalid, rather than the proper @("function1", "function2", "function3"). This tripped me up and I wasted a bunch of time on it, and I bet I'm not the only one.
@davidsmatlak would you consider reopening this?
@deadlydog I reopened Issue #4814 and will work on updating the document.
@deadlydog After a closer look at the doc, I agree, there is room for improvement. And we will make the types match the types specified for the parameters of New-ModuleManifest. Stay tuned for updates.