Skip to content

Commit 748a16a

Browse files
committed
Work on Azure pipelines
- Add install of nF VS extension Signed-off-by: José Simões <[email protected]>
1 parent 78a0eab commit 748a16a

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

azure-pipelines.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@ steps:
2020
feedsToUse: config
2121
nugetConfigPath: source/NuGet.config
2222

23+
# Download file
24+
# - task: DownloadFile@1
25+
# inputs:
26+
# FileUrl: 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage'
27+
28+
# # install nanoFramework VS extension
29+
# - task: PowerShell@2
30+
# inputs:
31+
# targetType: 'inline'
32+
# script: 'Install-Module VSSetup -Scope CurrentUser -AcceptLicense -Force'
33+
# errorActionPreference: 'stop'
34+
35+
# install nanoFramework VS extension
36+
- task: PowerShell@2
37+
inputs:
38+
filePath: 'install-nf-vs-extension.ps1'
39+
errorActionPreference: 'stop'
40+
41+
# # Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
42+
# - task: CmdLine@2
43+
# inputs:
44+
# script: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" /q D:\a\_temp\nanoFramework.Tools.VS2017.Extension.vsix'
45+
# #workingDirectory: # Optional
46+
# #failOnStderr: false # Optional
47+
2348
- task: VSBuild@1
2449
inputs:
2550
solution: '$(solution)'

install-nf-vs-extension.ps1

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright (c) 2018 The nanoFramework project contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
5+
# choco install wixtoolset -y --force
6+
7+
# #Installing VS extension 'Wix Toolset Visual Studio 2017 Extension'
8+
# Install-VsixExtension -Url 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage' -Name 'nanoFramework.Tools.VS2017.Extension.vsix'
9+
10+
11+
# # install VSSetup PS module (https://github.com/Microsoft/vssetup.powershell)
12+
# 'Installing VSSetup module ...' | Write-Host -ForegroundColor White
13+
# Install-Module VSSetup -Scope CurrentUser -AcceptLicense -Force
14+
15+
# # get Visual Studio install path
16+
# $vsInstallPath = Get-VSSetupInstance `
17+
# | Select-VSSetupInstance `
18+
# | Select-Object -ExpandProperty InstallationPath
19+
20+
# # extension path
21+
# $vsixPath = Join-Path $env:Agent_TempDirectory "nanoFramework.Tools.VS2017.Extension.vsix"
22+
23+
# "Downloading extension from marketplace..." | Write-Host -ForegroundColor White
24+
25+
# # # download extension from marketplace
26+
# $FileUrl = 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage'
27+
# # (New-Object Net.WebClient).DownloadFile('https://marketplace.visualstudio.com/_apis/public/gallery/publishers/vs-publisher-1470366/vsextensions/nanoFrameworkVS2017Extension/0/vspackage', $vsixPath)
28+
29+
# $start_time = Get-Date
30+
# Invoke-WebRequest -Uri "$FileUrl" -OutFile $vsixPath -UseDefaultCredentials -UseBasicParsing
31+
# Write-Host "Time taken to download: $((Get-Date).Subtract($start_time).Seconds) second(s)"
32+
33+
# # $installScript = Join-Path $env:Agent_TempDirectory "install-vsix.cmd"
34+
35+
$Url = "https://vs-publisher-1470366.gallerycdn.vsassets.io/extensions/vs-publisher-1470366/nanoframeworkvs2017extension/1.0.0.0/1539707795657/nanoFramework.Tools.VS2017.Extension.vsix"
36+
$Name = "nanoFramework.Tools.VS2017.Extension.vsix"
37+
38+
Write-Host "Downloading $Name..."
39+
$FilePath = "${env:Temp}\$Name"
40+
41+
Invoke-WebRequest -Uri $Url -OutFile $FilePath
42+
43+
$ArgumentList = ('/quiet', $FilePath)
44+
45+
Write-Host "Starting Install $Name..."
46+
$process = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru -NoNewWindow
47+
$exitCode = $process.ExitCode
48+
49+
if ($exitCode -eq 0 -or $exitCode -eq 3010)
50+
{
51+
Write-Host -Object 'Installation successful'
52+
return $exitCode
53+
}
54+
else
55+
{
56+
Write-Host -Object "Non zero exit code returned by the installation process : $exitCode."
57+
return $exitCode
58+
}
59+
60+
# install on process with timeout
61+
# Write-Host "Starting Install $Name..."
62+
63+
# $proc = Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe' -ArgumentList $ArgumentList -Wait -PassThru
64+
65+
# # keep track of timeout event
66+
# $timeouted = $null # reset any previously set timeout
67+
68+
# # wait up to 4 minutes (4 * 60 = 240 seconds) for normal termination
69+
# $proc | Wait-Process -Timeout 240 -ErrorAction SilentlyContinue -ErrorVariable timeouted
70+
71+
# if ($timeouted)
72+
# {
73+
# # terminate the process
74+
# $proc | kill
75+
76+
# # update internal error counter
77+
# }
78+
# elseif ($proc.ExitCode -ne 0)
79+
# {
80+
# # update internal error counter
81+
# }
82+
83+
84+
85+
# ("`"$vsInstallPath\Common7\IDE\VSIXInstaller.exe`" /q $vsixPath" | Out-File $installScript -Encoding ASCII)
86+
87+
# # "`"$vsInstallPath\Common7\IDE\VSIXInstaller.exe`" /q /a $vsixPath" | out-file ".\install-vsix.cmd" -Encoding ASCII
88+
# Start-Process -FilePath "$vsInstallPath\Common7\IDE\VSIXInstaller.exe" -ArgumentList "/q $extension" -Wait -PassThru
89+
90+
# 'Installing nanoFramework VS extension ...' | Write-Host -ForegroundColor White -NoNewline
91+
# Invoke-Expression "& '$env:ComSpec' '$installScript'"
92+
# Invoke-Expression "& '$installScript'"
93+
94+
# 'OK' | Write-Host -ForegroundColor Green

0 commit comments

Comments
 (0)