Skip to content

Commit

Permalink
MSIX: implement initial msix installer
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Dec 20, 2019
1 parent 303d1fe commit 2ea7e4d
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 0 deletions.
Binary file added installer/MSIX/Images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added installer/MSIX/Images/logo150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added installer/MSIX/Images/logo44.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions installer/MSIX/PackagingLayout.xml
Original file line number Diff line number Diff line change
@@ -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>
35 changes: 35 additions & 0 deletions installer/MSIX/appxmanifest.xml
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 5 additions & 0 deletions installer/MSIX/reinstall.ps1
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
14 changes: 14 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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." }
}
```
2 changes: 2 additions & 0 deletions src/common/common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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">
Expand Down
6 changes: 6 additions & 0 deletions src/common/common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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 changes: 11 additions & 0 deletions src/common/winstore.cpp
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions src/common/winstore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

bool running_as_packaged();

0 comments on commit 2ea7e4d

Please sign in to comment.