@@ -96,7 +96,8 @@ Source: "tools\*"; DestDir: "{app}\tools"; Flags: ignoreversion
96
96
Source : " {#ProductJsonPath}" ; DestDir : " {code:GetDestDir}\resources\app" ; Flags : ignoreversion
97
97
#ifdef AppxPackageName
98
98
#if " user" == InstallTarget
99
- Source : " appx\*" ; DestDir : " {app} \appx" ; BeforeInstall : RemoveAppxPackage; AfterInstall : AddAppxPackage; Flags : ignoreversion ; Check : IsWindows11OrLater
99
+ Source : " appx\{#AppxPackage}" ; DestDir : " {app} \appx" ; BeforeInstall : RemoveAppxPackage; Flags : ignoreversion ; Check : IsWindows11OrLater
100
+ Source : " appx\{#AppxPackageDll}" ; DestDir : " {app} \appx" ; AfterInstall : AddAppxPackage; Flags : ignoreversion ; Check : IsWindows11OrLater
100
101
#endif
101
102
#endif
102
103
@@ -1479,11 +1480,12 @@ begin
1479
1480
Log(S);
1480
1481
end ;
1481
1482
1482
- function AppxPackageInstalled (var ResultCode: Integer): Boolean;
1483
+ function AppxPackageInstalled (const name : String; var ResultCode: Integer): Boolean;
1483
1484
begin
1484
1485
AppxPackageFullname := ' ' ;
1485
1486
try
1486
- ExecAndLogOutput(' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command ' + AddQuotes(' Get-AppxPackage -Name '' {#AppxPackageName}'' | Select-Object -ExpandProperty PackageFullName' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, @ExecAndGetFirstLineLog);
1487
+ Log(' Get-AppxPackage for package with name: ' + name );
1488
+ ExecAndLogOutput(' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command ' + AddQuotes(' Get-AppxPackage -Name '' ' + name + ' '' | Select-Object -ExpandProperty PackageFullName' ), ' ' , SW_HIDE, ewWaitUntilTerminated, ResultCode, @ExecAndGetFirstLineLog);
1487
1489
except
1488
1490
Log(GetExceptionMessage);
1489
1491
end ;
@@ -1497,17 +1499,29 @@ procedure AddAppxPackage();
1497
1499
var
1498
1500
AddAppxPackageResultCode: Integer;
1499
1501
begin
1500
- if not AppxPackageInstalled(AddAppxPackageResultCode) then begin
1502
+ if not AppxPackageInstalled(ExpandConstant(' {#AppxPackageName}' ), AddAppxPackageResultCode) then begin
1503
+ Log(' Installing appx ' + AppxPackageFullname + ' ...' );
1501
1504
ShellExec(' ' , ' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command ' + AddQuotes(' Add-AppxPackage -Path '' ' + ExpandConstant(' {app}\appx\{#AppxPackage}' ) + ' '' -ExternalLocation '' ' + ExpandConstant(' {app}\appx' ) + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, AddAppxPackageResultCode);
1505
+ Log(' Add-AppxPackage complete.' );
1502
1506
end ;
1503
1507
end ;
1504
1508
1505
1509
procedure RemoveAppxPackage ();
1506
1510
var
1507
1511
RemoveAppxPackageResultCode: Integer;
1508
1512
begin
1509
- if AppxPackageInstalled(RemoveAppxPackageResultCode) then begin
1513
+ // Remove the old context menu package
1514
+ // Following condition can be removed after two versions.
1515
+ if QualityIsInsiders() and AppxPackageInstalled(' Microsoft.VSCodeInsiders' , RemoveAppxPackageResultCode) then begin
1516
+ Log(' Deleting old appx ' + AppxPackageFullname + ' installation...' );
1510
1517
ShellExec(' ' , ' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command ' + AddQuotes(' Remove-AppxPackage -Package '' ' + AppxPackageFullname + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1518
+ DeleteFile(ExpandConstant(' {app}\appx\code_insiders_explorer_{#Arch}.appx' ));
1519
+ DeleteFile(ExpandConstant(' {app}\appx\code_insiders_explorer_command.dll' ));
1520
+ end ;
1521
+ if AppxPackageInstalled(ExpandConstant(' {#AppxPackageName}' ), RemoveAppxPackageResultCode) then begin
1522
+ Log(' Removing current ' + AppxPackageFullname + ' appx installation...' );
1523
+ ShellExec(' ' , ' powershell.exe' , ' -NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -Command ' + AddQuotes(' Remove-AppxPackage -Package '' ' + AppxPackageFullname + ' '' ' ), ' ' , SW_HIDE, ewWaitUntilTerminated, RemoveAppxPackageResultCode);
1524
+ Log(' Remove-AppxPackage for current appx installation complete.' );
1511
1525
end ;
1512
1526
end ;
1513
1527
#endif
0 commit comments