PowerShell Snippet #10 – Check Version Number is Valid


Lately I’ve been working on PowerShell Modules that are published to PowerShell Gallery as part of a build process in VSTS. And so I’ve been creating version numbers and passing them as variables. However I wanted to validate them before they were applied. Below is a sample of how to verify that the version number you’re pushing conforms to semver

Any of the values in the VersionNumber array that do not match the regex are outputted in black on red text.


Leave a Reply

Your email address will not be published. Required fields are marked *