Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PS C:\Users\johan.andersson> cat S:\Scripts\Build\get-assemblyversion.ps1
- <#
- .SYNOPSIS
- Reads the AssemblyVersion attribute from a .CS file and returns an object consisting of the version
- .DESCRIPTION
- Specify the path to the .CS file
- #>
- param( [string] $assemblyInfoFile )
- $version = "" | select Major, Minor, Build, Revision
- gc $assemblyInfoFile | %{
- if( $_ -match "AssemblyVersion(Attribute)?\s*\(\s*`"([0-9]+).([0-9]+).([0-9]+).([0-9]+)`"\s*\)" ) {
- $version.Major = $matches[2]
- $version.Minor = $matches[3]
- $version.Build = $matches[4]
- $version.Revision = $matches[5]
- }
- }
- $versionmatch "AssemblyVersion(Attribute)?\s*\(\s*`"([0-9]+).([0-9]+).([0-9]+).([0-9]+)`"\s*\)" ) {
- $version.Major = $matches[2]
- $version.Minor = $matches[3]
- $version.Build = $matches[4]
- $version.Revision = $matches[5]
- }
- }
- $versionatches[2]
- $version.Minor = $matches[3]
- $version.Build = $matches[4]
- $version.Revision = $matches[5]
- }
- }
- $versionsion5]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement