PowerShell / PSScriptAnalyzer

Download ScriptAnalyzer from PowerShellGallery
https://www.powershellgallery.com/packages/PSScriptAnalyzer/
MIT License
1.84k stars 372 forks source link

PowerShellVersion should be required for modules #253

Open juneb opened 9 years ago

juneb commented 9 years ago

Users need to know the PS version requirements for a module. To specify, add a value for PowerShellVersion key in the module manifest.

To verify, get the manifest: iex (cat -raw (gmo -list ).Path)

Or PSModuleInfo (gmo -list ).PowerShellVersion

KirkMunro commented 9 years ago

I think it would be best if lack of a PowerShellVersion attribute generated a warning that the PowerShellVersion attribute should be added for any modules that require PowerShell 3.0 or later. Legacy modules written for PowerShell 2.0 that work as is without a PowerShellVersion attribute in the manifest shouldn't be forced to have a manifest update when it is actually not required (hence the warning).

joeyaiello commented 9 years ago

This brings up an interesting point about modules compatible with v2: we should probably provide a default profile that targets modules which intend to be compatible with v2.