├── .gitattributes ├── .gitignore ├── AppVeyor ├── appveyor.yml └── vsix.ps1 └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # Build results 11 | [Dd]ebug/ 12 | [Dd]ebugPublic/ 13 | [Rr]elease/ 14 | [Rr]eleases/ 15 | x64/ 16 | x86/ 17 | build/ 18 | bld/ 19 | [Bb]in/ 20 | [Oo]bj/ 21 | 22 | # Roslyn cache directories 23 | *.ide/ 24 | 25 | # MSTest test Results 26 | [Tt]est[Rr]esult*/ 27 | [Bb]uild[Ll]og.* 28 | 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | 33 | # Build Results of an ATL Project 34 | [Dd]ebugPS/ 35 | [Rr]eleasePS/ 36 | dlldata.c 37 | 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | 63 | # Chutzpah Test files 64 | _Chutzpah* 65 | 66 | # Visual C++ cache files 67 | ipch/ 68 | *.aps 69 | *.ncb 70 | *.opensdf 71 | *.sdf 72 | *.cachefile 73 | 74 | # Visual Studio profiler 75 | *.psess 76 | *.vsp 77 | *.vspx 78 | 79 | # TFS 2012 Local Workspace 80 | $tf/ 81 | 82 | # Guidance Automation Toolkit 83 | *.gpState 84 | 85 | # ReSharper is a .NET coding add-in 86 | _ReSharper*/ 87 | *.[Rr]e[Ss]harper 88 | *.DotSettings.user 89 | 90 | # JustCode is a .NET coding addin-in 91 | .JustCode 92 | 93 | # TeamCity is a build add-in 94 | _TeamCity* 95 | 96 | # DotCover is a Code Coverage Tool 97 | *.dotCover 98 | 99 | # NCrunch 100 | _NCrunch_* 101 | .*crunch*.local.xml 102 | 103 | # MightyMoose 104 | *.mm.* 105 | AutoTest.Net/ 106 | 107 | # Web workbench (sass) 108 | .sass-cache/ 109 | 110 | # Installshield output folder 111 | [Ee]xpress/ 112 | 113 | # DocProject is a documentation generator add-in 114 | DocProject/buildhelp/ 115 | DocProject/Help/*.HxT 116 | DocProject/Help/*.HxC 117 | DocProject/Help/*.hhc 118 | DocProject/Help/*.hhk 119 | DocProject/Help/*.hhp 120 | DocProject/Help/Html2 121 | DocProject/Help/html 122 | 123 | # Click-Once directory 124 | publish/ 125 | 126 | # Publish Web Output 127 | *.[Pp]ublish.xml 128 | *.azurePubxml 129 | # TODO: Comment the next line if you want to checkin your web deploy settings 130 | # but database connection strings (with potential passwords) will be unencrypted 131 | *.pubxml 132 | *.publishproj 133 | 134 | # NuGet Packages 135 | *.nupkg 136 | # The packages folder can be ignored because of Package Restore 137 | **/packages/* 138 | # except build/, which is used as an MSBuild target. 139 | !**/packages/build/ 140 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 141 | #!**/packages/repositories.config 142 | 143 | # Windows Azure Build Output 144 | csx/ 145 | *.build.csdef 146 | 147 | # Windows Store app package directory 148 | AppPackages/ 149 | 150 | # Others 151 | sql/ 152 | *.Cache 153 | ClientBin/ 154 | [Ss]tyle[Cc]op.* 155 | ~$* 156 | *~ 157 | *.dbmdl 158 | *.dbproj.schemaview 159 | *.pfx 160 | *.publishsettings 161 | node_modules/ 162 | 163 | # RIA/Silverlight projects 164 | Generated_Code/ 165 | 166 | # Backup & report files from converting an old project file 167 | # to a newer Visual Studio version. Backup files are not needed, 168 | # because we have git ;-) 169 | _UpgradeReport_Files/ 170 | Backup*/ 171 | UpgradeLog*.XML 172 | UpgradeLog*.htm 173 | 174 | # SQL Server files 175 | *.mdf 176 | *.ldf 177 | 178 | # Business Intelligence projects 179 | *.rdl.data 180 | *.bim.layout 181 | *.bim_*.settings 182 | 183 | # Microsoft Fakes 184 | FakesAssemblies/ 185 | 186 | # ========================= 187 | # Operating System Files 188 | # ========================= 189 | 190 | # OSX 191 | # ========================= 192 | 193 | .DS_Store 194 | .AppleDouble 195 | .LSOverride 196 | 197 | # Thumbnails 198 | ._* 199 | 200 | # Files that might appear on external disk 201 | .Spotlight-V100 202 | .Trashes 203 | 204 | # Directories potentially created on remote AFP share 205 | .AppleDB 206 | .AppleDesktop 207 | Network Trash Folder 208 | Temporary Items 209 | .apdisk 210 | 211 | # Windows 212 | # ========================= 213 | 214 | # Windows image file caches 215 | Thumbs.db 216 | ehthumbs.db 217 | 218 | # Folder config file 219 | Desktop.ini 220 | 221 | # Recycle Bin used on file shares 222 | $RECYCLE.BIN/ 223 | 224 | # Windows Installer files 225 | *.cab 226 | *.msi 227 | *.msm 228 | *.msp 229 | 230 | # Windows shortcuts 231 | *.lnk 232 | -------------------------------------------------------------------------------- /AppVeyor/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | 3 | install: 4 | - ps: (new-object Net.WebClient).DownloadString("https://raw.github.com/madskristensen/ExtensionScripts/master/AppVeyor/vsix.ps1") | iex 5 | 6 | before_build: 7 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion 8 | 9 | build_script: 10 | - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m 11 | 12 | after_test: 13 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery -------------------------------------------------------------------------------- /AppVeyor/vsix.ps1: -------------------------------------------------------------------------------- 1 | # VSIX Module for AppVeyor by Mads Kristensen 2 | [cmdletbinding()] 3 | param() 4 | 5 | $vsixUploadEndpoint = "https://www.vsixgallery.com/api/upload" 6 | #$vsixUploadEndpoint = "https://localhost:44372/api/upload" 7 | 8 | function Vsix-PushArtifacts { 9 | [cmdletbinding()] 10 | param ( 11 | [Parameter(Position=0, Mandatory=0,ValueFromPipeline=$true)] 12 | [string]$path = "./*.vsix", 13 | 14 | [switch]$publishToGallery 15 | ) 16 | process { 17 | foreach($filePath in $path) { 18 | $fileNames = (Get-ChildItem $filePath -Recurse -File) 19 | 20 | foreach($vsixFile in $fileNames) 21 | { 22 | if (Get-Command Update-AppveyorBuild -errorAction SilentlyContinue) 23 | { 24 | Write-Host ("Pushing artifact " + $vsixFile.Name + "...") -ForegroundColor Cyan -NoNewline 25 | Push-AppveyorArtifact ($vsixFile.FullName) -FileName $vsixFile.Name -DeploymentName "Latest build" 26 | Write-Host "OK" -ForegroundColor Green 27 | } 28 | 29 | if ($publishToGallery -and $vsixFile) 30 | { 31 | Vsix-PublishToGallery $vsixFile.FullName 32 | } 33 | } 34 | } 35 | } 36 | } 37 | 38 | function Vsix-GetRepoUrl{ 39 | [cmdletbinding()] 40 | param () 41 | if ($env:APPVEYOR_REPO_PROVIDER -contains "github"){ 42 | $repoUrl = "https://github.com/" + $env:APPVEYOR_REPO_NAME + "/" 43 | } elseif ($env:APPVEYOR_REPO_PROVIDER -contains "bitbucket"){ 44 | $repoUrl = "https://bitbucket.org/" + $env:APPVEYOR_REPO_NAME + "/" 45 | } else { 46 | $repoUrl = "" 47 | } 48 | return $repoUrl 49 | } 50 | 51 | function Vsix-PublishToGallery{ 52 | [cmdletbinding()] 53 | param ( 54 | [Parameter(Position=0, Mandatory=0,ValueFromPipeline=$true)] 55 | [string[]]$path = "./*.vsix", 56 | [string]$readmeUrl = "" 57 | ) 58 | foreach($filePath in $path){ 59 | if ($env:APPVEYOR_PULL_REQUEST_NUMBER){ 60 | return 61 | } 62 | 63 | $repo = "" 64 | $issueTracker = "" 65 | 66 | # If no readme URL was specified, default to "/README.md" 67 | if (-not $readmeUrl) { 68 | if ($env:APPVEYOR_REPO_BRANCH) { 69 | $readmeUrl = $env:APPVEYOR_REPO_BRANCH + "/README.md" 70 | } else { 71 | $readmeUrl = "master/README.md" 72 | } 73 | } 74 | 75 | $repoUrl = Vsix-GetRepoUrl 76 | if ($baseRepoUrl -ne "") { 77 | [Reflection.Assembly]::LoadWithPartialName("System.Web") | Out-Null 78 | $repo = [System.Web.HttpUtility]::UrlEncode($repoUrl) 79 | $issueTracker = [System.Web.HttpUtility]::UrlEncode(($repoUrl + "issues/")) 80 | $readmeUrl = [System.Web.HttpUtility]::UrlEncode($readmeUrl) 81 | } 82 | 83 | 'Publish to VSIX Gallery...' | Write-Host -ForegroundColor Cyan -NoNewline 84 | 85 | $fileNames = (Get-ChildItem $filePath -Recurse -File) 86 | 87 | foreach($vsixFile in $fileNames) 88 | { 89 | [string]$url = ($vsixUploadEndpoint + "?repo=" + $repo + "&issuetracker=" + $issueTracker + "&readmeUrl=" + $readmeUrl) 90 | [byte[]]$bytes = [System.IO.File]::ReadAllBytes($vsixFile) 91 | 92 | try { 93 | $webclient = New-Object System.Net.WebClient 94 | $webclient.UploadFile($url, $vsixFile) | Out-Null 95 | 'OK' | Write-Host -ForegroundColor Green 96 | } 97 | catch{ 98 | 'FAIL' | Write-Error 99 | $_.Exception.Response.Headers["x-error"] | Write-Error 100 | } 101 | } 102 | } 103 | } 104 | 105 | function Vsix-UpdateBuildVersion { 106 | [cmdletbinding()] 107 | param ( 108 | [Parameter(Position=0, Mandatory=1,ValueFromPipelineByPropertyName=$true)] 109 | [Version[]]$version, 110 | [Parameter(Position=1,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] 111 | $vsixFilePath, 112 | [switch]$updateOnPullRequests 113 | ) 114 | process{ 115 | if ($updateOnPullRequests -or !$env:APPVEYOR_PULL_REQUEST_NUMBER){ 116 | 117 | foreach($ver in $version) { 118 | if (Get-Command Update-AppveyorBuild -errorAction SilentlyContinue) 119 | { 120 | Write-Host "Updating AppVeyor build version..." -ForegroundColor Cyan -NoNewline 121 | Update-AppveyorBuild -Version $ver | Out-Null 122 | $ver | Write-Host -ForegroundColor Green 123 | } 124 | } 125 | } 126 | 127 | $vsixFilePath 128 | } 129 | } 130 | 131 | function Vsix-IncrementVsixVersion { 132 | [cmdletbinding()] 133 | param ( 134 | [Parameter(Position=0, Mandatory=0,ValueFromPipeline=$true)] 135 | [string[]]$manifestFilePath = ".\source.extension.vsixmanifest", 136 | 137 | [Parameter(Position=1, Mandatory=0)] 138 | [int]$buildNumber = $env:APPVEYOR_BUILD_NUMBER, 139 | 140 | [ValidateSet("build","revision")] 141 | [Parameter(Position=2, Mandatory=0)] 142 | [string]$versionType = "build", 143 | 144 | [switch]$updateBuildVersion 145 | ) 146 | process { 147 | foreach($manifestFile in $manifestFilePath) 148 | { 149 | "Incrementing VSIX version..." | Write-Host -ForegroundColor Cyan -NoNewline 150 | $matches = (Get-ChildItem $manifestFile -Recurse -File) 151 | $vsixManifest = $matches[$matches.Count - 1] # Get the last one which matches the top most file in the recursive matches 152 | [xml]$vsixXml = Get-Content $vsixManifest 153 | 154 | $ns = New-Object System.Xml.XmlNamespaceManager $vsixXml.NameTable 155 | $ns.AddNamespace("ns", $vsixXml.DocumentElement.NamespaceURI) | Out-Null 156 | 157 | $attrVersion = "" 158 | 159 | if ($vsixXml.SelectSingleNode("//ns:Identity", $ns)){ # VS2012 format 160 | $attrVersion = $vsixXml.SelectSingleNode("//ns:Identity", $ns).Attributes["Version"] 161 | } 162 | elseif ($vsixXml.SelectSingleNode("//ns:Version", $ns)){ # VS2010 format 163 | $attrVersion = $vsixXml.SelectSingleNode("//ns:Version", $ns) 164 | } 165 | 166 | [Version]$version = $attrVersion.Value 167 | 168 | if (!$attrVersion.Value){ 169 | $version = $attrVersion.InnerText 170 | } 171 | 172 | if ($versionType -eq "build"){ 173 | $version = New-Object Version ([int]$version.Major),([int]$version.Minor),$buildNumber 174 | } 175 | elseif ($versionType -eq "revision"){ 176 | $version = New-Object Version ([int]$version.Major),([int]$version.Minor),([System.Math]::Max([int]$version.Build, 0)),$buildNumber 177 | } 178 | 179 | $attrVersion.InnerText = $version 180 | 181 | $vsixXml.Save($vsixManifest) | Out-Null 182 | 183 | $version.ToString() | Write-Host -ForegroundColor Green 184 | 185 | if ($updateBuildVersion -and $env:APPVEYOR_BUILD_VERSION -ne $version.ToString()) 186 | { 187 | Vsix-UpdateBuildVersion $version | Out-Null 188 | } 189 | 190 | # return the values to the pipeline 191 | New-Object PSObject -Property @{ 192 | 'vsixFilePath' = $vsixManifest 193 | 'Version' = $version 194 | } 195 | } 196 | } 197 | } 198 | 199 | function Vsix-IncrementNuspecVersion { 200 | [cmdletbinding()] 201 | param ( 202 | [Parameter(Position=0, Mandatory=0)] 203 | [string[]]$nuspecFilePath = ".\**\*.nuspec", 204 | 205 | [Parameter(Position=1, Mandatory=0)] 206 | [Version]$buildVersion = $env:APPVEYOR_BUILD_VERSION 207 | ) 208 | process { 209 | foreach($nuspecFile in $nuspecFilePath) 210 | { 211 | "Incrementing Nuspec version..." | Write-Host -ForegroundColor Cyan -NoNewline 212 | $matches = (Get-ChildItem $nuspecFile -Recurse -File) 213 | $nuspec = $matches[$matches.Count - 1] # Get the last one which matches the top most file in the recursive matches 214 | [xml]$vsixXml = Get-Content $nuspec 215 | 216 | $ns = New-Object System.Xml.XmlNamespaceManager $vsixXml.NameTable 217 | $ns.AddNamespace("ns", $vsixXml.DocumentElement.NamespaceURI) | Out-Null 218 | 219 | $elmVersion = $vsixXml.SelectSingleNode("//ns:version", $ns) 220 | 221 | $elmVersion.InnerText = $buildVersion 222 | 223 | $vsixXml.Save($nuspec) | Out-Null 224 | 225 | $buildVersion.ToString() | Write-Host -ForegroundColor Green 226 | 227 | # return the values to the pipeline 228 | New-Object PSObject -Property @{ 229 | 'vsixFilePath' = $nuspec 230 | 'Version' = $version 231 | } 232 | } 233 | } 234 | } 235 | 236 | function Vsix-TokenReplacement { 237 | [cmdletbinding()] 238 | param ( 239 | [Parameter(Position=0, Mandatory=$true)] 240 | [string]$FilePath, 241 | 242 | [Parameter(Position=1, Mandatory=$true)] 243 | [string]$searchString, 244 | 245 | [Parameter(Position=2, Mandatory=$true)] 246 | [string]$replacement 247 | ) 248 | process { 249 | 250 | $replacement = $replacement.Replace("{version}", $env:APPVEYOR_BUILD_VERSION) 251 | 252 | "Replacing $searchString with $replacement..." | Write-Host -ForegroundColor Cyan -NoNewline 253 | 254 | $content = [string]::join([environment]::newline, (get-content $FilePath)) 255 | $regex = New-Object System.Text.RegularExpressions.Regex $searchString 256 | 257 | $regex.Replace($content, $replacement) | Out-File $FilePath 258 | 259 | "OK" | Write-Host -ForegroundColor Green 260 | } 261 | } 262 | 263 | function Vsix-CreateChocolatyPackage { 264 | [cmdletbinding()] 265 | param ( 266 | [Parameter(Position=0, Mandatory=0)] 267 | [string[]]$manifestFilePath = ".\source.extension.vsixmanifest", 268 | 269 | [Parameter(Position=1, Mandatory=1)] 270 | [string]$packageId 271 | ) 272 | process { 273 | 274 | if ([String]::IsNullOrEmpty($pacakgeId)){ 275 | $error = New-Object System.ArgumentNullException "packageID is null or empty" 276 | } 277 | 278 | foreach($manifestFile in $manifestFilePath) 279 | { 280 | "Creating Cholocatey package..." | Write-Host -ForegroundColor Cyan -NoNewline 281 | $matches = (Get-ChildItem $manifestFile -Recurse -File) 282 | $vsixManifest = $matches[$matches.Count - 1] # Get the last one which matches the top most file in the recursive matches 283 | 284 | $vsixManifestDirectory = Split-Path -Parent -Path $vsixManifest 285 | $vsixFile = Get-ChildItem -Path $vsixManifestDirectory -Filter '*.vsix' -Recurse -File | Select-Object -First 1 286 | $hash = $vsixFile | Get-FileHash -Algorithm SHA256 | Select-Object -ExpandProperty Hash 287 | 288 | [xml]$vsixXml = Get-Content $vsixManifest 289 | 290 | $ns = New-Object System.Xml.XmlNamespaceManager $vsixXml.NameTable 291 | $ns.AddNamespace("ns", $vsixXml.DocumentElement.NamespaceURI) | Out-Null 292 | 293 | $id = "" 294 | $version = "" 295 | $author = "" 296 | $displayName = "" 297 | $description = "" 298 | $tags = "" 299 | $icon = "" 300 | $preview = "" 301 | $repoUrl = Vsix-GetRepoUrl 302 | 303 | if ($vsixXml.SelectSingleNode("//ns:Identity", $ns)){ # VS2012 format 304 | $id = $vsixXml.SelectSingleNode("//ns:Identity", $ns).Attributes["Id"].Value 305 | $version = $vsixXml.SelectSingleNode("//ns:Identity", $ns).Attributes["Version"].Value 306 | $author = $vsixXml.SelectSingleNode("//ns:Identity", $ns).Attributes["Publisher"].Value 307 | $displayName = $vsixXml.SelectSingleNode("//ns:DisplayName", $ns).InnerText 308 | $description = $vsixXml.SelectSingleNode("//ns:Description", $ns).InnerText 309 | $tags = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 310 | $Icon = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 311 | $PreviewImage = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 312 | } 313 | elseif ($vsixXml.SelectSingleNode("//ns:Version", $ns)){ # VS2010 format 314 | $id = $vsixXml.SelectSingleNode("//ns:Identity", $ns).Attributes["Id"].Value 315 | $version = $vsixXml.SelectSingleNode("//ns:Version", $ns).InnerText 316 | $author = $vsixXml.SelectSingleNode("//ns:Author", $ns).InnerText 317 | $displayName = $vsixXml.SelectSingleNode("//ns:Name", $ns).InnerText 318 | $description = $vsixXml.SelectSingleNode("//ns:Description", $ns).InnerText 319 | $tags = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 320 | $Icon = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 321 | $PreviewImage = $vsixXml.SelectSingleNode("//ns:Tags", $ns).InnerText 322 | } 323 | 324 | 325 | [System.IO.DirectoryInfo]$folder = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), ".vsixbuild", "$id") 326 | 327 | [System.IO.Directory]::CreateDirectory($folder.FullName) | Out-Null 328 | 329 | $XmlWriter = New-Object System.XMl.XmlTextWriter(($folder.FullName + "\chocolatey.nuspec"), (New-Object System.Text.UTF8Encoding)) 330 | $xmlWriter.Formatting = "Indented" 331 | $xmlWriter.Indentation = "4" 332 | 333 | $xmlWriter.WriteStartDocument() 334 | $xmlWriter.WriteStartElement("package") 335 | $XmlWriter.WriteAttributeString("xmlns", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd") 336 | 337 | $xmlWriter.WriteStartElement("metadata") 338 | $XmlWriter.WriteElementString("id", $packageId) 339 | $XmlWriter.WriteElementString("version", $version) 340 | $XmlWriter.WriteElementString("title", $displayName) 341 | $XmlWriter.WriteElementString("description", $description) 342 | $XmlWriter.WriteElementString("authors", $author) 343 | $XmlWriter.WriteElementString("owners", $author) 344 | $XmlWriter.WriteElementString("tags", "visualstudio extension vsix") 345 | $XmlWriter.WriteElementString("licenseUrl", "http://vsixgallery.com/extension/" + $id + "/") 346 | $XmlWriter.WriteElementString("projectUrl", "http://vsixgallery.com/extension/" + $id + "/") 347 | $XmlWriter.WriteElementString("iconUrl", "http://vsixgallery.com/extensions/" + $id + "/icon.png") 348 | $XmlWriter.WriteElementString("packageSourceUrl", $repoUrl) 349 | $XmlWriter.WriteStartElement("dependencies") 350 | $XmlWriter.WriteStartElement("dependency") 351 | $XmlWriter.WriteAttributeString("id", "chocolatey-visualstudio.extension") 352 | $XmlWriter.WriteAttributeString("version", "1.6.0") 353 | $XmlWriter.WriteEndElement() # dependency 354 | $XmlWriter.WriteEndElement() # dependencies 355 | $XmlWriter.WriteEndElement() # metadata 356 | 357 | $XmlWriter.WriteStartElement("files") 358 | $XmlWriter.WriteStartElement("file") 359 | $XmlWriter.WriteAttributeString("src", "chocolateyInstall.ps1") 360 | $XmlWriter.WriteAttributeString("target", "tools") 361 | $XmlWriter.WriteEndElement() # file 362 | $XmlWriter.WriteEndElement() # files 363 | 364 | $xmlWriter.WriteEndElement() # package 365 | $xmlWriter.WriteEndDocument() 366 | 367 | $XmlWriter.Flush() 368 | $XmlWriter.Dispose() 369 | 370 | $sb = New-Object System.Text.StringBuilder 371 | $sb.AppendLine("`$name = `'" + $displayName + "`'") | Out-Null 372 | $sb.AppendLine("`$url = `'" + "https://vsixgallery.azurewebsites.net/extensions/" + $id + "/" + $displayName + ".vsix`'") | Out-Null 373 | $sb.AppendLine("`$checksum = `'" + $hash + "`'") | Out-Null 374 | $sb.AppendLine("`$checksumType = `'SHA256`'") | Out-Null 375 | $sb.AppendLine("Install-VisualStudioVsixExtension `$name `$url -Checksum `$checksum -ChecksumType `$checksumType") | Out-Null 376 | 377 | 378 | New-Item ($folder.FullName + "\chocolateyInstall.ps1") -type file -force -value $sb.ToString() | Out-Null 379 | 380 | Push-Location $folder.FullName 381 | 382 | try{ 383 | & choco pack | Out-Null 384 | 385 | Write-Host "OK" -ForegroundColor Green 386 | 387 | if (Get-Command Update-AppveyorBuild -errorAction SilentlyContinue) 388 | { 389 | $nupkg = Get-ChildItem $folder.FullName -Filter *.nupkg -File 390 | Write-Host ("Pushing Chocolatey package " + $nupkg.Name + "...") -ForegroundColor Cyan -NoNewline 391 | Push-AppveyorArtifact ($nupkg.FullName) -FileName $nupkg.Name -DeploymentName "Chocolatey package" 392 | Write-Host "OK" -ForegroundColor Green 393 | } 394 | } 395 | finally{ 396 | Pop-Location 397 | } 398 | } 399 | } 400 | } 401 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Automation scripts for Visual Studio extensions 2 | 3 | If you are building Visual Studio extensions (VSIX) then this is for you. 4 | 5 | This script can do the following: 6 | 7 | 1. increment --------------------------------------------------------------------------------