-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvsix.ps1
34 lines (26 loc) · 1.34 KB
/
vsix.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function Vsix-ChangeBuildNumber {
$manifestFilePath = Resolve-Path ".\VS-QuickNavigation\source.extension.vsixmanifest"
$assemblyFilePath = Resolve-Path ".\VS-QuickNavigation\Properties\AssemblyInfo.cs"
$buildNumber = [int]$env:APPVEYOR_BUILD_VERSION
# Updating manifest build version
"Updating manifest build version..." | Write-Host
$manifestContent = Get-Content $manifestFilePath
$manifestXml = [xml]$manifestContent
[Version]$version = $manifestXml.PackageManifest.Metadata.Identity.Version
$version = New-Object Version ([int]$version.Major),([int]$version.Minor),$buildNumber
$manifestXml.PackageManifest.Metadata.Identity.Version = [string]$version
"New version is " + $manifestXml.PackageManifest.Metadata.Identity.Version | Write-Host
#$manifestXml.Save([System.Console]::Out)
$manifestXML.Save($manifestFilePath)
# Updating assembly build version
"Updating assembly build version..." | Write-Host
$assemblyContent = Get-Content $assemblyFilePath
$assemblyContent = $assemblyContent -replace "public const string Version = ""(\d.\d)""", "public const string Version = ""$version""";
Set-Content $assemblyFilePath $assemblyContent
if (Get-Command Update-AppveyorBuild -errorAction SilentlyContinue)
{
"Update AppVeyor version..." | Write-Host
Update-AppveyorBuild -Version $version | Out-Null
}
"Version changed" | Write-Host
}