mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
make VS19ExtensionVersion function
This commit is contained in:
@@ -18,4 +18,5 @@ Export-ModuleMember -Function @(
|
|||||||
'Add-SoftwareDetailsToMarkdown'
|
'Add-SoftwareDetailsToMarkdown'
|
||||||
'Stop-SvcWithErrHandling'
|
'Stop-SvcWithErrHandling'
|
||||||
'Set-SvcWithErrHandling'
|
'Set-SvcWithErrHandling'
|
||||||
|
'Get-VS19ExtensionVersion'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ function Install-EXE
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Stop-SvcWithErrHandling
|
function Stop-SvcWithErrHandling
|
||||||
<#
|
<#
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Function for stopping the Windows Service with error handling
|
Function for stopping the Windows Service with error handling
|
||||||
|
|
||||||
.AUTHOR
|
.AUTHOR
|
||||||
@@ -98,7 +98,7 @@ Switch for stopping the script and exit from PowerShell if one service is absent
|
|||||||
#>
|
#>
|
||||||
{
|
{
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory, ValueFromPipeLine = $true)] [string] $ServiceName,
|
[Parameter(Mandatory, ValueFromPipeLine = $true)] [string] $ServiceName,
|
||||||
[Parameter()] [switch] $StopOnError
|
[Parameter()] [switch] $StopOnError
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -126,8 +126,8 @@ Switch for stopping the script and exit from PowerShell if one service is absent
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Set-SvcWithErrHandling
|
function Set-SvcWithErrHandling
|
||||||
<#
|
<#
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Function for setting the Windows Service parameter with error handling
|
Function for setting the Windows Service parameter with error handling
|
||||||
|
|
||||||
.AUTHOR
|
.AUTHOR
|
||||||
@@ -140,7 +140,7 @@ The name of stopping service
|
|||||||
Hashtable for service arguments
|
Hashtable for service arguments
|
||||||
#>
|
#>
|
||||||
{
|
{
|
||||||
|
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory, ValueFromPipeLine = $true)] [string] $ServiceName,
|
[Parameter(Mandatory, ValueFromPipeLine = $true)] [string] $ServiceName,
|
||||||
[Parameter(Mandatory)] [hashtable] $Arguments
|
[Parameter(Mandatory)] [hashtable] $Arguments
|
||||||
@@ -160,3 +160,31 @@ Hashtable for service arguments
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-VS19ExtensionVersion
|
||||||
|
{
|
||||||
|
param (
|
||||||
|
[string] [Parameter(Mandatory=$true)] $packageName
|
||||||
|
)
|
||||||
|
|
||||||
|
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
|
||||||
|
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
|
||||||
|
|
||||||
|
if($instanceFolders -is [array])
|
||||||
|
{
|
||||||
|
Write-Host "More than one instance installed"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
|
||||||
|
$state = $stateContent | ConvertFrom-Json
|
||||||
|
$packageVersion = ($state.packages | Where-Object { $_.id -eq $packageName }).version
|
||||||
|
|
||||||
|
if (!$packageVersion)
|
||||||
|
{
|
||||||
|
Write-Host "installed package $packageName for Visual Studio 2019 was not found"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packageVersion
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,28 +3,7 @@
|
|||||||
## Desc: Validate the installation of the Windows Driver Kit
|
## Desc: Validate the installation of the Windows Driver Kit
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
function Get-WDKExtensionPackage {
|
Import-Module -Name ImageHelpers -Force
|
||||||
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
|
|
||||||
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
|
|
||||||
|
|
||||||
if($instanceFolders -is [array])
|
|
||||||
{
|
|
||||||
Write-Host "More than one instance installed"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
|
|
||||||
$state = $stateContent | ConvertFrom-Json
|
|
||||||
$WDKPackageVersion = ($state.packages | where { $_.id -eq "Microsoft.Windows.DriverKit" }).version
|
|
||||||
|
|
||||||
if (!$WDKPackageVersion)
|
|
||||||
{
|
|
||||||
Write-Host "WDK package for Visual studio was not found"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return $WDKPackageVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-WDKVersion
|
function Get-WDKVersion
|
||||||
{
|
{
|
||||||
@@ -40,7 +19,7 @@ function Get-WDKVersion
|
|||||||
}
|
}
|
||||||
|
|
||||||
$WDKVersion = Get-WDKVersion
|
$WDKVersion = Get-WDKVersion
|
||||||
$WDKPackageVersion = Get-WDKExtensionPackage
|
$WDKPackageVersion = Get-VS19ExtensionVersion -packageName "Microsoft.Windows.DriverKit"
|
||||||
|
|
||||||
# Adding description of the software to Markdown
|
# Adding description of the software to Markdown
|
||||||
$SoftwareName = "Windows Driver Kit"
|
$SoftwareName = "Windows Driver Kit"
|
||||||
|
|||||||
@@ -11,23 +11,6 @@ function Get-WixVersion {
|
|||||||
return $Version
|
return $Version
|
||||||
}
|
}
|
||||||
|
|
||||||
#Gets the extension details from state.json
|
|
||||||
function Get-WixExtensionPackage {
|
|
||||||
$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances"
|
|
||||||
$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName
|
|
||||||
|
|
||||||
if($instanceFolders -is [array])
|
|
||||||
{
|
|
||||||
Write-Host "More than one instance installed"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
$stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json')
|
|
||||||
$state = $stateContent | ConvertFrom-Json
|
|
||||||
$WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev16" }
|
|
||||||
return $WixPackage
|
|
||||||
}
|
|
||||||
|
|
||||||
$WixToolSetVersion = Get-WixVersion
|
$WixToolSetVersion = Get-WixVersion
|
||||||
|
|
||||||
if($WixToolSetVersion) {
|
if($WixToolSetVersion) {
|
||||||
@@ -38,22 +21,14 @@ else {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$WixPackage = Get-WixExtensionPackage
|
$WixPackageVersion = Get-VS19ExtensionVersion -packageName "WixToolset.VisualStudioExtension.Dev16"
|
||||||
|
|
||||||
if($WixPackage) {
|
|
||||||
Write-Host "Wix Extension version" $WixPackage.version "installed"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Wix Extension is not installed"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Adding description of the software to Markdown
|
# Adding description of the software to Markdown
|
||||||
$SoftwareName = "WIX Tools"
|
$SoftwareName = "WIX Tools"
|
||||||
|
|
||||||
$Description = @"
|
$Description = @"
|
||||||
_Toolset Version:_ $WixToolSetVersion<br/>
|
_Toolset Version:_ $WixToolSetVersion<br/>
|
||||||
_WIX Toolset Visual Studio Extension Version:_ $($WixPackage.version)<br/>
|
_WIX Toolset Visual Studio Extension Version:_ $WixPackageVersion<br/>
|
||||||
_Environment:_
|
_Environment:_
|
||||||
* WIX: Installation root of WIX
|
* WIX: Installation root of WIX
|
||||||
"@
|
"@
|
||||||
|
|||||||
Reference in New Issue
Block a user