-
Notifications
You must be signed in to change notification settings - Fork 4
/
Publish-Vsix.ps1
35 lines (31 loc) · 1.42 KB
/
Publish-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
35
[CmdletBinding(SupportsShouldProcess=$true)]
param (
[parameter(Mandatory=$true,
HelpMessage="Publisher name which must match publisher in the manifest")]
[string] $publisherName
,
[parameter(Mandatory=$true,
HelpMessage="Token with Organization: All accessible organizations, Selected scopes: Marketplace (publish)")]
[string] $personalAccessToken
,
[parameter(Mandatory=$true,
HelpMessage="Path to the .vsix file for publishing")]
[string] $payload
,
[parameter(Mandatory=$true,
HelpMessage="Path to the publish manifest .json file")]
[string] $publishManifest = "$PSScriptRoot\publishManifest.json"
)
Install-Module -Name VSSetup -RequiredVersion 2.2.5 -Scope CurrentUser -Force
Import-Module -Name VSSetup -Version 2.2.5
$VSSetupInstance = Get-VSSetupInstance | Select-VSSetupInstance -Product * -Require 'Microsoft.VisualStudio.Component.VSSDK'
$VSInstallDir=$VSSetupInstance.InstallationPath
$VsixPublisher="$VSInstallDir\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
if ($PSCmdlet.ShouldProcess("VsixPublisher.exe login -publisherName $publisherName -personalAccessToken $personalAccessToken", "Login"))
{
& $VsixPublisher login -publisherName $publisherName -personalAccessToken $personalAccessToken
}
if ($PSCmdlet.ShouldProcess("VsixPublisher.exe publish -payload $payload -publishManifest $publishManifest", "Publish"))
{
& $VsixPublisher publish -payload $payload -publishManifest $publishManifest
}