Skip to content

Commit bece5db

Browse files
authored
chore: cleanup inno setup for context menu install (microsoft#164411)
1 parent f5fdf67 commit bece5db

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

build/azure-pipelines/win32/product-build-win32.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,16 @@ steps:
286286
. build/azure-pipelines/win32/exec.ps1
287287
$ErrorActionPreference = "Stop"
288288
exec { node build\azure-pipelines\common\sign $env:EsrpCliDllPath windows $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(CodeSigningFolderPath) '*.dll,*.exe,*.node' }
289-
exec { node build\azure-pipelines\common\sign $env:EsrpCliDllPath windows-appx $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(CodeSigningFolderPath) '*.appx' }
290289
displayName: Codesign
291290
291+
- ${{ if eq(parameters.VSCODE_QUALITY, 'insider') }}:
292+
- powershell: |
293+
. build/azure-pipelines/win32/exec.ps1
294+
$ErrorActionPreference = "Stop"
295+
exec { node build\azure-pipelines\common\sign $env:EsrpCliDllPath windows-appx $(ESRP-PKI) $(esrp-aad-username) $(esrp-aad-password) $(CodeSigningFolderPath) '*.appx' }
296+
displayName: Codesign context menu appx package
297+
condition: and(succeeded(), ne(variables['VSCODE_PUBLISH'], 'false'))
298+
292299
- ${{ if eq(parameters.VSCODE_PUBLISH, true) }}:
293300
- powershell: |
294301
. build/azure-pipelines/win32/exec.ps1

build/win32/code.iss

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ ShowLanguageDialog=auto
3434
ArchitecturesAllowed={#ArchitecturesAllowed}
3535
ArchitecturesInstallIn64BitMode={#ArchitecturesInstallIn64BitMode}
3636
WizardStyle=modern
37-
SetupLogging=yes
3837

3938
#ifdef Sign
4039
SignTool=esrp
@@ -89,7 +88,7 @@ Name: "{app}"; AfterInstall: DisableAppDirInheritance
8988
[Files]
9089
Source: "*"; Excludes: "\CodeSignSummary*.md,\tools,\tools\*,\appx,\appx\*,\resources\app\product.json"; DestDir: "{code:GetDestDir}"; Flags: ignoreversion recursesubdirs createallsubdirs
9190
Source: "tools\*"; DestDir: "{app}\tools"; Flags: ignoreversion
92-
Source: "appx\*"; DestDir: "{app}\appx"; BeforeInstall: RemoveAppxPackage; AfterInstall: AddAppxPackage; Flags: ignoreversion
91+
Source: "appx\*"; DestDir: "{app}\appx"; BeforeInstall: RemoveAppxPackage; AfterInstall: AddAppxPackage; Flags: ignoreversion; Check: IsWindows11OrLater and QualityIsInsiders
9392
Source: "{#ProductJsonPath}"; DestDir: "{code:GetDestDir}\resources\app"; Flags: ignoreversion
9493

9594
[Icons]
@@ -1423,26 +1422,22 @@ procedure AddAppxPackage();
14231422
var
14241423
AddAppxPackageResultCode: Integer;
14251424
begin
1426-
if IsWindows11OrLater() and QualityIsInsiders() then begin
1427-
if WizardIsTaskSelected('addcontextmenufiles') then begin
1428-
ShellExec('', 'powershell.exe', '-Command ' + AddQuotes('Add-AppxPackage -Path ''' + ExpandConstant('{app}\appx\{#AppxPackage}') + ''' -ExternalLocation ''' + ExpandConstant('{app}\appx') + ''''), '', SW_HIDE, ewWaitUntilTerminated, AddAppxPackageResultCode);
1429-
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\*\shell\{#RegValueName}');
1430-
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\directory\shell\{#RegValueName}');
1431-
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\directory\background\shell\{#RegValueName}');
1432-
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\Drive\shell\{#RegValueName}');
1433-
end;
1425+
if WizardIsTaskSelected('addcontextmenufiles') then begin
1426+
ShellExec('', 'powershell.exe', '-Command ' + AddQuotes('Add-AppxPackage -Path ''' + ExpandConstant('{app}\appx\{#AppxPackage}') + ''' -ExternalLocation ''' + ExpandConstant('{app}\appx') + ''''), '', SW_HIDE, ewWaitUntilTerminated, AddAppxPackageResultCode);
1427+
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\*\shell\{#RegValueName}');
1428+
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\directory\shell\{#RegValueName}');
1429+
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\directory\background\shell\{#RegValueName}');
1430+
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\Drive\shell\{#RegValueName}');
14341431
end;
14351432
end;
14361433
14371434
procedure RemoveAppxPackage();
14381435
var
14391436
RemoveAppxPackageResultCode: Integer;
14401437
begin
1441-
if IsWindows11OrLater() and QualityIsInsiders() then begin
1442-
ShellExec('', 'powershell.exe', '-Command ' + AddQuotes('Remove-AppxPackage -Package ''{#AppxPackageFullname}'''), '', SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1443-
if not WizardIsTaskSelected('addcontextmenufiles') then begin
1444-
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\{#RegValueName}ContextMenu');
1445-
end;
1438+
ShellExec('', 'powershell.exe', '-Command ' + AddQuotes('Remove-AppxPackage -Package ''{#AppxPackageFullname}'''), '', SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1439+
if not WizardIsTaskSelected('addcontextmenufiles') then begin
1440+
RegDeleteKeyIncludingSubkeys({#EnvironmentRootKey}, 'Software\Classes\{#RegValueName}ContextMenu');
14461441
end;
14471442
end;
14481443

0 commit comments

Comments
 (0)