-
-
Save scottdurow/fe844a012c388f2e3e8bafdf4a2d897d to your computer and use it in GitHub Desktop.
Update Solution Version PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VersionRegex = "\d+\.\d+\.(\d+\.\d+)" | |
# Apply the version to the solution | |
$NewVersion = "1.0.$($VersionData[0].Groups[1])" | |
Write-Output "Solution Version: $NewVersion" | |
$VersionRegexProject = "<Version>\d+\.\d+.\d+.\d+</Version>" | |
$file = "$($Env:BUILD_SOURCESDIRECTORY)\SolutionPackage\package\Other\Solution.xml" | |
Write-Output $file | |
$filecontent = Get-Content($file) | |
attrib $file -r | |
$filecontent -replace $VersionRegexProject, "<Version>$NewVersion</Version>" | Out-File $file -Encoding ascii | |
Write-Verbose "$($file) - Solution version applied" | |
# Apply the version to PCF Manifest | |
$NewVersion = "0.$($VersionData[0].Groups[1])" | |
Write-Output "PCF Version: $NewVersion" | |
$VersionRegexProject = "version=""\d+\.\d+\.\d+""" | |
$file = "$($Env:BUILD_SOURCESDIRECTORY)\PCF\ControlManifest.Input.xml" | |
Write-Output $file | |
$filecontent = Get-Content($file) | |
attrib $file -r | |
$filecontent -replace $VersionRegexProject, "version=""$NewVersion""" | Out-File $file -Encoding ascii | |
Write-Verbose "$($file) - PCF version applied" | |
# Apply the version to the assembly property files | |
$NewVersion = "1.0.$($VersionData[0].Groups[1])" | |
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' | |
Write-Output "Plugin Vesion: $NewVersion" | |
$VersionRegexProject = "AssemblyVersion\(""\d+\.\d+\.\d+\.\d+""\)" | |
$file = "$($Env:BUILD_SOURCESDIRECTORY)\Plugins\Properties\AssemblyInfo.cs" | |
Write "$($file)" | |
$filecontent = Get-Content($file) | |
attrib $file -r | |
$filecontent -replace $VersionRegexProject, "AssemblyVersion(""$NewVersion"")" | Out-File $file | |
Write-Verbose "$($file) - Plugin version applied" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easier to read imho