@@ -17,106 +17,11 @@ if (-not (Test-Path "$root/.tools/reportgenerator.exe")) {
1717 Write-Host - Foreground Green " ✅ Installed dotnet-reportgenerator-globaltool"
1818}
1919
20- # NuGet.exe for non-SDK style projects, like UnitsNet.nanoFramework.
21- if (-not (Test-Path " $nugetPath " )) {
22- Write-Host - Foreground Blue " Downloading NuGet.exe..."
23- Invoke-WebRequest - Uri https:// dist.nuget.org/ win- x86- commandline/ latest/ nuget.exe - OutFile $nugetPath
24- Write-Host - Foreground Green " ✅ Downloaded NuGet.exe: $nugetPath "
25- }
26-
27- # ##################################################
28- # # TODO: OK to remove after moving to AZDO pipeline
29- $VsWherePath = " ${env: PROGRAMFILES(X86)} \Microsoft Visual Studio\Installer\vswhere.exe"
30-
31- # Check if Visual Studio is installed
32- if (Test-Path $VsWherePath ) {
33- $VsPath = $ (& $VsWherePath - latest - property installationPath 2> $null )
34- if ($VsPath ) {
35- $msbuildPath = Join-Path - Path $VsPath - ChildPath " \MSBuild"
36- Write-Host - Foreground Green " Visual Studio found at: $VsPath "
37- } else {
38- Write-Host - Foreground Yellow " Visual Studio not found via vswhere, NanoFramework builds will be skipped"
39- $VsPath = $null
40- $msbuildPath = $null
41- }
42- } else {
43- Write-Host - Foreground Yellow " Visual Studio not installed - NanoFramework builds will be skipped"
44- $VsPath = $null
45- $msbuildPath = $null
46- }
47-
4820# Install dotnet CLI tools declared in /.config/dotnet-tools.json
4921pushd $root
5022dotnet tool restore
5123popd
5224
53- # Install .NET nanoFramework build components
54- if ($msbuildPath -and ! (Test-Path " $msbuildPath /nanoFramework" )) {
55- Write-Host " Installing .NET nanoFramework VS extension..."
56-
57- [System.Net.WebClient ]$webClient = New-Object System.Net.WebClient
58- $webClient.Headers.Add (" User-Agent" , " request" )
59- $webClient.Headers.Add (" Accept" , " application/vnd.github.v3+json" )
60-
61- $releaseList = $webClient.DownloadString (' https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/releases?per_page=100' )
62-
63- if ($releaseList -match ' \"(?<VS2022_version>v2022\.\d+\.\d+\.\d+)\"' )
64- {
65- $vs2022Tag = $Matches.VS2022_version
66- }
67-
68- if ($releaseList -match ' \"(?<VS2019_version>v2019\.\d+\.\d+\.\d+)\"' )
69- {
70- $vs2019Tag = $Matches.VS2019_version
71- }
72-
73- # Find which VS version is installed
74- $VsWherePath = " ${env: PROGRAMFILES(X86)} \Microsoft Visual Studio\Installer\vswhere.exe"
75-
76- Write-Output " VsWherePath is: $VsWherePath "
77-
78- $VsInstance = $ (& $VSWherePath - latest - property displayName 2> $null )
79-
80- Write-Output " Latest VS is: $VsInstance "
81-
82- # Get extension details according to VS version, starting from VS2022 down to VS2019
83- # TODO check if the extension for VS2022 is compatible it VS2026
84- if ($vsInstance.Contains (' 2026' ) -or $vsInstance.Contains (' 2022' ))
85- {
86- $extensionUrl = " https://github.com/nanoframework/nf-Visual-Studio-extension/releases/download/$vs2022Tag /nanoFramework.Tools.VS2022.Extension.vsix"
87- $vsixPath = Join-Path $tempDir " nanoFramework.Tools.VS2022.Extension.zip"
88- $extensionVersion = $vs2022Tag
89- }
90- elseif ($vsInstance.Contains (' 2019' ))
91- {
92- $extensionUrl = " https://github.com/nanoframework/nf-Visual-Studio-extension/releases/download/$vs2019Tag /nanoFramework.Tools.VS2019.Extension.vsix"
93- $vsixPath = Join-Path $tempDir " nanoFramework.Tools.VS2019.Extension.zip"
94- $extensionVersion = $vs2019Tag
95- }
96-
97- Write-Output " Downloading visx..."
98-
99- # download VS extension
100- Write-Host " Download VSIX file from $extensionUrl to $vsixPath "
101- $webClient.DownloadFile ($extensionUrl , $vsixPath )
102-
103- $outputPath = " $tempDir \nf-extension"
104-
105- $vsixPath = Join-Path - Path $tempDir - ChildPath " nf-extension.zip"
106- $webClient.DownloadFile ($extensionUrl , $vsixPath )
107-
108- Write-Host " Extract VSIX file to $outputPath "
109- Expand-Archive - LiteralPath $vsixPath - DestinationPath $outputPath - Force | Write-Host
110-
111- $copyFrom = " $outputPath \`$ MSBuild\nanoFramework"
112-
113- Write-Host " Copy from $copyFrom to $msbuildPath "
114- Copy-Item - Path " $copyFrom " - Destination $msbuildPath - Recurse
115-
116- Write-Host " Installed VS extension $extensionVersion "
117- }
118- # ##################################################
119-
12025# Cleanup
12126[system.io.Directory ]::Delete($tempDir , $true ) | out-null
12227
0 commit comments