Skip to content

Commit

Permalink
Add temp/ to .gitignore for temporary files. Added temp\MSTest.pfx ge…
Browse files Browse the repository at this point in the history
…neration for inner-loop development needing signed MSIX. NOTE: This will be updated in a future PR to pull MSTest.pfx from the Azure Key Vault.
  • Loading branch information
DrusTheAxe committed Mar 8, 2021
1 parent 46ea056 commit 47bb22e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ installer/dev/project_reunion_definitions_override.h
# Installer test packages
!installer/test/testpackages/

# Local temp storage
temp/

# Project Reunion specific files
Microsoft.WinUI.AppX.targets
dev/vsix/extension/LICENSE
Expand Down
71 changes: 69 additions & 2 deletions tools/DevCheck.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
.PARAMETER CheckTestCert
Check the Test certificate
.PARAMETER CheckTestPfx
Check the MSIX Test signing certificate (to sign developer test MSIXs)
.PARAMETER CheckVisualStudio
Check Visual Studio
Expand All @@ -38,6 +41,8 @@
Param(
[Switch]$CheckAll=$false,

[Switch]$CheckTestPfx=$false,

[Switch]$CheckTAEFService=$false,

[Switch]$CheckTestCert=$false,
Expand All @@ -53,7 +58,7 @@ Param(

$global:issues = 0

if (($CheckTAEFService -eq $false) -And ($CheckTestCert -eq $false) -And ($CheckVisualStudio -eq $false))
if (($CheckTestPfx -eq $false) -And ($CheckTAEFService -eq $false) -And ($CheckTestCert -eq $false) -And ($CheckVisualStudio -eq $false))
{
$CheckAll = $true
}
Expand Down Expand Up @@ -183,6 +188,59 @@ function Test-VisualStudio2019Install
Write-Host "VisualStudio 2019...$path"
}

function Test-DevTestPfx
{
if ($Clean -eq $true)
{
return $false
}

$root = Get-ProjectRoot
$pfx = Join-Path $root 'temp\MSTest.pfx'
if (Test-Path -Path $pfx -PathType Leaf)
{
Write-Host 'Test temp\MSTest.pfx...OK'
return $true
}
else
{
Write-Host 'Test temp\MSTest.pfx...Not Found'
$global:issues += 1
return $false
}
}

function Repair-DevTestPfx
{
$root = Get-ProjectRoot
$temp = Join-Path $root 'temp'
if (-not(Test-Path -Path $temp -PathType Container))
{
Write-Host 'Creating $temp...'
New-Item -Path $temp -ItemType Directory -Force
}

$spfx = Join-Path $root 'build\MSTest.spfx'
$pfx = Join-Path $temp 'MSTest.pfx'
$args = " -decode $spfx $pfx"
if ($Verbose -eq $true)
{
$args = " -v $args"
}
Write-Host "*** certutil.exe $args"
$output = Run-Process 'certutil.exe' $args
if (Test-Path -Path $pfx -PathType Leaf)
{
Write-Host 'Create temp\MSTest.pfx...OK'
}
else
{
Write-Host 'Create temp\MSTest.pfx...Errpr'
Write-Verbose $output
$global:issues += 1
}
}

function Test-DevTestCert
{
# To manually determine the thumbprint of a *.cer file
Expand All @@ -194,7 +252,7 @@ function Test-DevTestCert
# That 3535... value is the 'Thumbprint' property

$root = Get-ProjectRoot
$path = Join-Path $root 'build\MSTest.pfx'
$path = Join-Path $root 'temp\MSTest.pfx'
$pfx = Get-PfxCertificate -FilePath $path
$thumbprint = $pfx.Thumbprint

Expand Down Expand Up @@ -340,6 +398,15 @@ if (($CheckAll -ne $false) -Or ($CheckVisualStudio -ne $false))
Test-VisualStudio2019Install
}

if (($CheckAll -ne $false) -Or ($CheckTestPfx -ne $false))
{
$test = Test-DevTestPfx
if ($test -ne $true)
{
Repair-DevTestPfx
}
}

if (($CheckAll -ne $false) -Or ($CheckTestCert -ne $false))
{
$test = Test-DevTestCert
Expand Down

0 comments on commit 47bb22e

Please sign in to comment.