MSIX: implement initial msix installer

This commit is contained in:
yuyoyuppe 2019-12-18 13:19:15 +03:00 committed by yuyoyuppe
parent b58d4e306a
commit 860087d291
12 changed files with 105 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,25 @@
<PackagingLayout xmlns="http://schemas.microsoft.com/appx/makeappx/2017">
<PackageFamily ID="PowerToys" FlatBundle="true" ManifestPath="appxmanifest.xml" ResourceManager="false">
<Package ID="x64" ProcessorArchitecture="x64">
<Files>
<File DestinationPath="License.rtf" SourcePath="..\..\License.rtf"/>
<File DestinationPath="PowerToys.exe" SourcePath="..\..\x64\Release\PowerToys.exe"/>
<File DestinationPath="PowerToysSettings.exe" SourcePath="..\..\x64\Release\PowerToysSettings.exe"/>
<File DestinationPath="modules\FancyZonesEditor.exe" SourcePath="..\..\x64\Release\modules\FancyZonesEditor.exe"/>
<File DestinationPath="modules\ControlzEx.dll" SourcePath="..\..\x64\Release\modules\ControlzEx.dll"/>
<File DestinationPath="modules\fancyzones.dll" SourcePath="..\..\x64\Release\modules\fancyzones.dll"/>
<File DestinationPath="modules\MahApps.Metro.dll" SourcePath="..\..\x64\Release\modules\MahApps.Metro.dll"/>
<File DestinationPath="modules\Microsoft.Xaml.Behaviors.dll" SourcePath="..\..\x64\Release\modules\Microsoft.Xaml.Behaviors.dll"/>
<File DestinationPath="modules\PowerRenameExt.dll" SourcePath="..\..\x64\Release\modules\PowerRenameExt.dll"/>
<File DestinationPath="modules\shortcut_guide.dll" SourcePath="..\..\x64\Release\modules\shortcut_guide.dll"/>
<File DestinationPath="svgs\*" SourcePath="..\..\x64\Release\svgs\*"/>
<File DestinationPath="settings-html\**" SourcePath="..\..\x64\Release\settings-html\**"/>
<File DestinationPath="Images\*.png" SourcePath="Images\*.png"/>
</Files>
</Package>
</PackageFamily>
</PackagingLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
<Identity Name="PowerToys" Version="0.15.0.0" Publisher="CN=Microsoft Corporation" ProcessorArchitecture="x64" />
<!-- todo: try porting as a project? https://github.com/microsoft/DesktopBridgeToUWP-Samples/blob/master/Samples/AppServiceBridgeSample_C%2B%2B/cs/UWP/UWP.csproj -->
<Properties>
<DisplayName>PowerToys</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Description>Windows system utilities to maximize productivity</Description>
<Logo>Images\logo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.18362.30" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust"/>
<rescap:Capability Name="allowElevation"/>
</Capabilities>
<Applications>
<Application Id="PowerToys" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="PowerToys" Description="Windows system utilities to maximize productivity" Square150x150Logo="Images\logo150.png" Square44x44Logo="Images\logo44.png" BackgroundColor="transparent" />
<Extensions>
<uap5:Extension Category="windows.startupTask" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
<uap5:StartupTask TaskId="PowerToysStartupTaskID" Enabled="true" DisplayName="PowerToys" />
</uap5:Extension>
</Extensions>
</Application>
</Applications>
</Package>

View File

@ -0,0 +1,5 @@
$name='PowerToys'
Get-AppxPackage -Name $name | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
makeappx build /v /overwrite /f PackagingLayout.xml /id "x64" /op bin\
signtool sign /debug /a /fd SHA256 /f PowerToysTestKey.pfx /p 12345 bin\x64.msix
Add-AppxPackage .\bin\x64.msix

View File

@ -90,6 +90,10 @@
<TargetMachine>MachineX64</TargetMachine>
<UACExecutionLevel>HighestAvailable</UACExecutionLevel>
</Link>
<CustomBuildStep Label="BuildMSIX">
<Command>cd $(SolutionDir)MSIX &amp;&amp; makeappx build /overwrite /f PackagingLayout.xml /id x64 /op bin\ &amp;&amp; signtool sign /a /fd SHA256 /f PowerToysTestKey.pfx /p 12345 bin\x64.msix</Command>
<Outputs>$(SolutionDir)MSIX\bin\x64.msix</Outputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CustomAction.cpp" />

View File

@ -5,3 +5,17 @@
* Install the [WiX Toolset build tools](https://wixtoolset.org/releases/) in the development machine.
* Open `powertoys.sln`, select the "Release" and "x64" configurations and build the `PowerToysSetup` project.
* The resulting installer will be built to `PowerToysSetup\bin\Release\PowerToysSetup.msi`.
## Building and installing self-signed PowerToys MSIX package
* Make sure you've built correct `powertoys.sln` configuration
* Add `PowerToysTestKey.pfx` to the [TRCA store](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/trusted-root-certification-authorities-certificate-store)
* Execute `reinstall.ps1` from the devenv powershell:
## Removing all current PowerToys installations
```ps
$name='PowerToys'
Get-AppxPackage -Name $name | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
gwmi win32_product -filter "Name = '$name'" -namespace root/cimv2 | foreach {
if ($_.uninstall().returnvalue -eq 0) { write-host "Successfully uninstalled $name " }
else { write-warning "Failed to uninstall $name." }
}
```

View File

@ -112,6 +112,7 @@
<ClInclude Include="two_way_pipe_message_ipc.h" />
<ClInclude Include="version.h" />
<ClInclude Include="windows_colors.h" />
<ClInclude Include="winstore.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="animation.cpp" />
@ -133,6 +134,7 @@
<ClCompile Include="tasklist_positions.cpp" />
<ClCompile Include="common.cpp" />
<ClCompile Include="windows_colors.cpp" />
<ClCompile Include="winstore.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -78,6 +78,9 @@
<ClInclude Include="json.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="winstore.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="d2d_svg.cpp">
@ -126,5 +129,8 @@
<ClCompile Include="json.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="winstore.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

11
src/common/winstore.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "pch.h"
#include "winstore.h"
#include <appmodel.h>
bool running_as_packaged()
{
UINT32 length = 0;
const auto rc = GetPackageFamilyName(GetCurrentProcess(), &length, nullptr);
return rc != APPMODEL_ERROR_NO_PACKAGE;
}

3
src/common/winstore.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
bool running_as_packaged();