AssemblyVersion regular expression
It seems that I keep having to come up with a regular expression that validates and parses a version string. I often use this for customising TFS build workflows for extracting and using application version information.
The AssemblyVersionAttribute appears to have the following rules:
- Major version is required
- Minor version is optional and will default to 0 if not specified
- Minor version cannot be *
- Build and Revision versions are optional and may be *
- Revision number cannot be specified if the build number is *
The following is the regular expression that covers all these rules.