Skip to content

Instantly share code, notes, and snippets.

View mjfusa's full-sized avatar

Mike Francis mjfusa

  • Microsoft
  • Roseville, California, USA
View GitHub Profile
mjfusa / installchoco.cmd
Last active December 5, 2018 23:19
Chocolatey Install for new PC
if '%errorlevel%' == '0' ( goto continue
) else ( powershell "saps -filepath %0 -verb runas" >nul 2>&1)
exit /b
cd %~dp0
powershell Set-ExecutionPolicy bypass -force
powershell -f setpath.ps1
powershell Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(''))
mjfusa / fileSaveSpartanPWA.htm
Created October 25, 2019 22:56
File Save from (Spartan) Edge PWA
function saveBlob (blob, fileName) {
var a = document.createElement("a");
document.body.appendChild(a); = "display: none";
var url = window.URL.createObjectURL(blob);
a.href = url; = fileName;;
mjfusa / FindPackageForUser.cs
Created November 19, 2019 01:19
Detect if MS Store app is installed
// Companion to:
public static bool IsAppAlreadyInstalled(string FullPackageFamilyName)
var oPkgManager = new PackageManager();
bool result = false;
//If 1st parameter is string.Empty, the packages are retrieved for the current user.
Package oPkg = oPkgManager.FindPackageForUser(string.Empty, FullPackageFamilyName);
result = oPkg != null;
mjfusa / SaveToFileEdgeHTML.htm
Last active January 29, 2020 23:50
EdgeHTML PWA Save to File
In EdgeHTML / PWA downloading content by creating a download link on the fly and calling Click (traditional method) does not work.
TL;DR: See below for an implementation of the file download for EdgeHTML / PWA.
Longer explanation:
When running with the Spartan WebView as a HWA (Hosted Web App) or PWA MS Store, you’re running inside a UWP container with the associated security restriction. This has 2 implications:
• msSaveOrOpenBlob is not defined in this execution context for security reasons
• you can’t download directly a file on the file system using the + approach
mjfusa / Microsoft App Commerce Client and REST
Last active November 25, 2020 19:44
Microsoft App Commerce Client and REST APIs
App Commerce Client and REST APIs
Client API Available REST API Available Client API Documentation REST API Documentation
All Available Products for App
Yes No Get product info for apps and add-ons - UWP
Query Products Owned by User (Durables,Consumables) Yes Yes
mjfusa / appxmanifest-partial.xml
Created March 11, 2021 21:08
MSIX Manifest Entries for Windows Service
<desktop6:Extension Category="windows.service" EntryPoint="Windows.FullTrustApplication" Executable="WindowsServiceSample.exe">
<desktop6:Service Name="WindowsService Sample" StartAccount="localSystem" StartupType="auto" />
<rescap:Capability Name="runFullTrust"/>
<rescap:Capability Name="localSystemServices"/>
<rescap:CapabiIity Name="packagedServices"/>
mjfusa / .\createvm.ps1
Created July 9, 2021 16:48
Create VM with iso OS
mjfusa / ProtocolFileExtensionAliasManifest.xml
Created November 11, 2021 19:39
Example of Protocol, File Extension, Alias, definition in AppxManifest.xml
<uap:Extension Category="windows.fileTypeAssociation">
<uap:FileTypeAssociation Name="wpfmsix">
<uap:DisplayName>WPF MSIX Detect</uap:DisplayName>
<uap:InfoTip>Detect MSIX Container</uap:InfoTip>
mjfusa / MainWindow.xaml.cs
Last active November 21, 2021 06:37
Project Reunion 0.5 WinUI Desktop - Store IAP and Window Initialization
using Microsoft.UI.Xaml;
using System;
using System.Runtime.InteropServices;
using Windows.Services.Store;
using WinRT;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see:
namespace App12Reunion

Question: How can we install our UWP app with the required dependencies without an internet connection?

Answer: Per the question, if you are connected to the internet, the app dependencies as defined in manifest will be downloaded and installed from the Store. Typically, the dependencies list in the manifest looks like this: To install the dependencies without a connection to the internet, you must create the packages for sideloading. (In Visual Studio, Publish, Create App