2
2
[cmdletbinding ()]
3
3
param ()
4
4
5
- $vsixUploadEndpoint = " http ://vsixgallery.com/api/upload"
5
+ $vsixUploadEndpoint = " https ://www. vsixgallery.com/api/upload"
6
6
7
7
function Vsix-PushArtifacts {
8
8
[cmdletbinding ()]
@@ -15,7 +15,7 @@ function Vsix-PushArtifacts {
15
15
process {
16
16
foreach ($filePath in $path ) {
17
17
$fileNames = (Get-ChildItem $filePath - Recurse)
18
-
18
+
19
19
foreach ($vsixFile in $fileNames )
20
20
{
21
21
if (Get-Command Update-AppveyorBuild - errorAction SilentlyContinue)
@@ -78,7 +78,8 @@ function Vsix-PublishToGallery{
78
78
[byte []]$bytes = [System.IO.File ]::ReadAllBytes($vsixFile )
79
79
80
80
try {
81
- $response = Invoke-WebRequest $url - Method Post - Body $bytes - UseBasicParsing
81
+ $webclient = New-Object System.Net.WebClient
82
+ $webclient.UploadFile ($url , $vsixFile ) | Out-Null
82
83
' OK' | Write-Host - ForegroundColor Green
83
84
}
84
85
catch {
@@ -240,7 +241,7 @@ function Vsix-TokenReplacement {
240
241
241
242
$content = [string ]::join([environment ]::newline, (get-content $FilePath ))
242
243
$regex = New-Object System.Text.RegularExpressions.Regex $searchString
243
-
244
+
244
245
$regex.Replace ($content , $replacement ) | Out-File $FilePath
245
246
246
247
" OK" | Write-Host - ForegroundColor Green
@@ -257,7 +258,7 @@ function Vsix-CreateChocolatyPackage {
257
258
[string ]$packageId
258
259
)
259
260
process {
260
-
261
+
261
262
if ([String ]::IsNullOrEmpty($pacakgeId )){
262
263
$error = New-Object System.ArgumentNullException " packageID is null or empty"
263
264
}
@@ -307,8 +308,8 @@ function Vsix-CreateChocolatyPackage {
307
308
$Icon = $vsixXml.SelectSingleNode (" //ns:Tags" , $ns ).InnerText
308
309
$PreviewImage = $vsixXml.SelectSingleNode (" //ns:Tags" , $ns ).InnerText
309
310
}
310
-
311
-
311
+
312
+
312
313
[System.IO.DirectoryInfo ]$folder = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath(), " .vsixbuild" , " $id " )
313
314
314
315
[System.IO.Directory ]::CreateDirectory($folder.FullName ) | Out-Null
@@ -333,6 +334,12 @@ function Vsix-CreateChocolatyPackage {
333
334
$XmlWriter.WriteElementString (" projectUrl" , " http://vsixgallery.com/extension/" + $id + " /" )
334
335
$XmlWriter.WriteElementString (" iconUrl" , " http://vsixgallery.com/extensions/" + $id + " /icon.png" )
335
336
$XmlWriter.WriteElementString (" packageSourceUrl" , $repoUrl )
337
+ $XmlWriter.WriteStartElement (" dependencies" )
338
+ $XmlWriter.WriteStartElement (" dependency" )
339
+ $XmlWriter.WriteAttributeString (" id" , " chocolatey-visualstudio.extension" )
340
+ $XmlWriter.WriteAttributeString (" version" , " 1.6.0" )
341
+ $XmlWriter.WriteEndElement () # dependency
342
+ $XmlWriter.WriteEndElement () # dependencies
336
343
$XmlWriter.WriteEndElement () # metadata
337
344
338
345
$XmlWriter.WriteStartElement (" files" )
@@ -353,9 +360,9 @@ function Vsix-CreateChocolatyPackage {
353
360
$sb.AppendLine (" `$ url = `' " + " https://vsixgallery.azurewebsites.net/extensions/" + $id + " /" + $displayName + " .vsix`' " ) | Out-Null
354
361
$sb.AppendLine (" `$ checksum = `' " + $hash + " `' " ) | Out-Null
355
362
$sb.AppendLine (" `$ checksumType = `' SHA256`' " ) | Out-Null
356
- $sb.AppendLine (" Install-ChocolateyVsixPackage `$ name `$ url -Checksum `$ checksum -ChecksumType `$ checksumType" ) | Out-Null
363
+ $sb.AppendLine (" Install-VisualStudioVsixExtension `$ name `$ url -Checksum `$ checksum -ChecksumType `$ checksumType" ) | Out-Null
364
+
357
365
358
-
359
366
New-Item ($folder.FullName + " \chocolateyInstall.ps1" ) - type file - force - value $sb.ToString () | Out-Null
360
367
361
368
Push-Location $folder.FullName
@@ -378,4 +385,4 @@ function Vsix-CreateChocolatyPackage {
378
385
}
379
386
}
380
387
}
381
- }
388
+ }
0 commit comments