Home
%3CLINGO-SUB%20id%3D%22lingo-sub-739019%22%20slang%3D%22en-US%22%3EIntroducing%20the%20new%20App%20Installer%20template%20in%20Visual%20Studio%202019%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-739019%22%20slang%3D%22en-US%22%3E%3CP%3En%20the%20lasts%20months%20we%20have%20learned%2C%20here%20in%20this%20blog%2C%20how%20App%20Installer%20can%20help%20you%20distribute%20MSIX%20packages%20and%20keep%20them%20automatically%20updated%20without%20using%20the%20Store.%20First%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FWindows-Dev-AppConsult%2FHandling-auto-updates-for-sideloaded-UWP-and-Desktop-Bridge-apps%2Fba-p%2F317082%22%20target%3D%22_blank%22%3Ewe%20have%20learned%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ehow%20to%20generate%20such%20a%20file%20with%20Visual%20Studio%20and%20the%20wizard%20to%20create%20MSIX%20packages%20starting%20from%20a%20UWP%20project%20or%20a%20Windows%20Application%20Packaging%20Project.%20Then%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FWindows-Dev-AppConsult%2FHandling-application-updates-with-App-Installer-and-MSIX-in%2Fba-p%2F355389%22%20target%3D%22_blank%22%3Ein%20another%20post%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewe%20have%20learned%20how%20Windows%2010%201903%20has%20introduced%20some%20highly%20requested%20features%2C%20like%20the%20ability%20to%20declare%20an%20update%20as%20critical%20or%20to%20show%20a%20prompt%20to%20the%20user%20to%20notify%20him%20that%20an%20update%20is%20available.%3C%2FP%3E%0A%3CP%3EUnfortunately%2C%20until%20a%20while%20ago%2C%20there%20wasn't%20the%20chance%20to%20combine%20both%20these%20features%20in%20an%20easy%20way.%20When%20you%20start%20the%20wizard%20to%20generate%20a%20MSIX%20package%20and%20you%20opt-in%20for%20sideloading%20with%20auto%20updates%2C%20you%20can%20only%20specify%20a%20few%20options%2C%20like%20the%20URL%20where%20the%20package%20will%20be%20published%20and%20the%20update%20frequency.%20What%20if%20I%20want%20to%20use%20one%20of%20the%20new%20features%20added%20in%201903%2C%20like%20adding%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EShowPrompt%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eattribute%20to%20trigger%20the%20update%20notification%3F%20Right%20now%2C%20the%20only%20solution%20is%20to%20manually%20edit%20the%20.appinstaller%20file%20generated%20by%20Visual%20Studio%20after%20the%20package%20creation%20process%20has%20been%20completed.%20This%20approach%20is%20hard%20to%20maintain%2C%20especially%20if%20you're%20planning%20to%20leverage%20an%20agile%20approach%20and%20setup%20a%20CI%2FCD%20pipeline%20to%20automatically%20build%20and%20deploy%20your%20applications.%20You%20would%20need%20to%20add%20to%20add%20a%20task%20in%20your%20pipeline%20which%20manipulates%20the%20.appinstaller%20file%20and%20manually%20add%20the%20required%20attributes.%3C%2FP%3E%0A%3CP%3EStarting%20from%20Visual%20Studio%202019%2016.1%2C%20instead%2C%20there's%20a%20better%20solution%3A%20the%20App%20Installer%20template.%20Thanks%20to%20this%20template%2C%20which%20can%20be%20added%20inside%20a%20UWP%20or%20Windows%20Application%20Packaging%20Project%2C%20you%20can%20define%20the%20look%20%26amp%3B%20feel%20of%20the%20App%20Installer%20file%20and%20set%20some%20of%20the%20information%20as%20parameters%2C%20which%20will%20be%20automatically%20replaced%20by%20the%20real%20values%20during%20the%20package%20generation.%3C%2FP%3E%0A%3CP%3ELet's%20see%20an%20example.%3C%2FP%3E%0A%3CH3%20id%3D%22add-an-app-installer-template%22%20id%3D%22toc-hId-1594252122%22%20id%3D%22toc-hId-1594256022%22%20id%3D%22toc-hId-1594256022%22%20id%3D%22toc-hId-1594256022%22%20id%3D%22toc-hId-1594256022%22%3EAdd%20an%20App%20Installer%20template%3C%2FH3%3E%0A%3CP%3ELet's%20assume%20that%20we%20have%20a%20Win32%20application%20packaged%20with%20the%20Windows%20Application%20Packaging%20Project%2C%20as%20in%20the%20following%20image%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20327px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122273iCB1006F2E0A31D6A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22wapp.png%22%20title%3D%22wapp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ERight%20click%20on%20the%20Windows%20Application%20Packaging%20Project%20and%20choose%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20New%20item%3C%2FSTRONG%3E%3CSPAN%3E.%20Among%20the%20available%20templates%2C%20you%20will%20find%20a%20new%20one%20called%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20Installer%3C%2FSTRONG%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20943px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122274i9B2CDC4738726607%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22template.png%22%20title%3D%22template.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EGive%20it%20a%20name.%20The%20new%20file%2C%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E.appinstaller%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eextension%2C%20will%20be%20included%20inside%20the%20project%20and%20it%20will%20look%20like%20this%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-23%22%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-meta%22%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EAppInstaller%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BAppInstallerUri%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BVersion%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3Exmlns%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fappx%2Fappinstaller%2F2018%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EMainBundle%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BName%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BVersion%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EPublisher%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BPublisher%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BMainPackageUri%7D%22%3C%2FSPAN%3E%2F%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EOnLaunch%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EHoursBetweenUpdateChecks%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%220%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%0A%0A%3CSPAN%20class%3D%22hljs-tag%22%3EAppInstaller%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAs%20you%20can%20see%2C%20all%20the%20information%20which%20are%20dynamic%20and%20which%20are%20dependent%20by%20the%20package%20configuration%20are%20included%20with%20a%20placeholder%2C%20wrapped%20inside%20graphs.%20All%20these%20values%20will%20be%20replaced%20with%20the%20ones%20from%20the%20manifest%20and%20from%20the%20project's%20configuration%20during%20the%20package%20creation%20wizard.%3C%2FP%3E%0A%3CP%3EWhich%20is%20the%20advantage%20of%20this%20approach%3F%20Let's%20say%20that%20we%20want%20to%20leverage%20the%20new%20feature%20to%20display%20a%20notification%20to%20the%20user%20when%20he%20opens%20the%20application%20and%20an%20update%20is%20available.%20We%20just%20need%20to%20add%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EShowPrompt%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eattribute%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOnLaunch%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eentry%2C%20as%20in%20the%20following%20example%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-45%22%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-meta%22%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EAppInstaller%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BAppInstallerUri%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BVersion%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3Exmlns%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fappx%2Fappinstaller%2F2018%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EMainBundle%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BName%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BVersion%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EPublisher%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BPublisher%7D%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22%7BMainPackageUri%7D%22%3C%2FSPAN%3E%2F%26gt%3B%3C%2FSPAN%3E%0A%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EOnLaunch%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EHoursBetweenUpdateChecks%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%220%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EShowPrompt%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22true%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%0A%0A%3CSPAN%20class%3D%22hljs-tag%22%3EAppInstaller%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EFrom%20now%20on%2C%20when%20we're%20going%20to%20generate%20a%20new%20package%2C%20all%20the%20parameters%20will%20be%20replaced%20with%20the%20real%20value%2C%20but%20the%20new%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EShowPrompt%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eattribute%2C%20being%20fixed%2C%20will%20stay%20as%20it%20is.%3C%2FP%3E%0A%3CP%3ELet's%20generate%20a%20package%20to%20test%20this.%20Right%20click%20on%20the%20Windows%20Application%20Packaging%20Project%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EStore%20%E2%86%92%20Create%20app%20packages%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20then%2C%20in%20the%20first%20screen%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESideloading%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20leave%20the%20option%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EEnable%20automatic%20updates%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eturned%20on.%20In%20the%20next%20step%2C%20choose%20the%20package%20configuration%20as%20usual%2C%20then%20hit%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENext%3C%2FSTRONG%3E.%20Now%20you%20will%20notice%20something%20different.%20You%20will%20still%20be%20able%20to%20configure%20the%20URL%20where%20you're%20going%20to%20deploy%20the%20package%20(which%20will%20be%20used%20to%20replace%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%7BAppInstallerUri%7D%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20in%20the%20App%20Installer%20template)%2C%20but%20you%20won't%20be%20able%20to%20configure%20the%20update%20frequency%20anymore.%20Additionally%2C%20the%20screen%20will%20display%20a%20warning%20that%20an%20App%20Installer%20template%20has%20been%20detected.%20Since%20now%20the%20update%20policies%20are%20controlled%20by%20the%20App%20Installer%20template%2C%20you%20don't%20need%20to%20set%20them%20anymore%20during%20the%20wizard.%20Actually%2C%20this%20is%20a%20good%20thing%20because%20the%20wizard%20doesn't%20support%20the%20new%20features%20introduced%20in%20Windows%2010%201903%2C%20so%20the%20template%20gives%20you%20more%20flexibility.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20788px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122275iAD1DE3541A1D2A68%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22sideloading.png%22%20title%3D%22sideloading.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThat's%20it.%20Now%20generate%20the%20package%20and%2C%20at%20the%20end%20of%20the%20process%2C%20you%20will%20see%20that%20the%20App%20Installer%20file%20will%20have%20retained%20the%20custom%20update%20frequency%2C%20but%20all%20the%20other%20values%20will%20have%20been%20replaced%20with%20the%20real%20ones%20which%20belong%20to%20your%20app%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-71%22%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-meta%22%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EAppInstaller%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22https%3A%2F%2Fdb-msixtest.azurewebsites.net%2FContosoExpenses.Package.appinstaller%22%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%221.0.5.0%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Exmlns%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22http%3A%2F%2Fschemas.microsoft.com%2Fappx%2Fappinstaller%2F2017%2F2%22%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EMainBundle%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22ContosoExpenses%22%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%221.0.5.0%22%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EPublisher%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22CN%3DMatteo%20Pagani%2C%20O%3DMatteo%20Pagani%2C%20L%3DComo%2C%20S%3DComo%2C%20C%3DIT%22%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EUri%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22https%3A%2F%2Fdb-msixtest.azurewebsites.net%2FContosoExpenses.Package_1.0.5.0_Test%2FContosoExpenses.Package_1.0.5.0_x86.msixbundle%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EOnLaunch%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EHoursBetweenUpdateChecks%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%220%22%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22hljs-attr%22%3EShowPrompt%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22True%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22hljs-tag%22%3EUpdateSettings%3C%2FSPAN%3E%26gt%3B%0A%3CSPAN%20class%3D%22hljs-tag%22%3EAppInstaller%3C%2FSPAN%3E%26gt%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH3%20id%3D%22app-installer-and-devops%22%20id%3D%22toc-hId--957904839%22%20id%3D%22toc-hId--957900939%22%20id%3D%22toc-hId--957900939%22%20id%3D%22toc-hId--957900939%22%20id%3D%22toc-hId--957900939%22%3EApp%20Installer%20and%20Azure%20DevOps%3C%2FH3%3E%0A%3CP%3EIf%20you%20have%20a%20CI%2FCD%20pipeline%20for%20your%20desktop%20application%20hosted%20on%20Azure%20DevOps%2C%20there's%20a%20good%20news!%20The%20latest%20image%20for%20the%20Windows%20hosted%20agent%20includes%20Visual%20Studio%202019%2016.1%2C%20so%20you%20can%20leverage%20the%20App%20Installer%20template%20also%20in%20your%20pipeline.%20It's%20enough%20to%20use%2C%20as%20Windows%20image%2C%20the%20one%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows-2019%3C%2FSTRONG%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Fagents%2Fhosted%3Fview%3Dazure-devops%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eas%20described%20in%20the%20documentation%3C%2FA%3E.%20This%20way%20you'll%20be%20able%20to%20automatically%20deploy%20on%20a%20website%20the%20MSIX%20package%20and%20the%20custom%20App%20Installer%20file%2C%20without%20having%20to%20manually%20change%20it%20to%20support%20the%20new%20features%20added%20in%20Windows%2010%201903.%3C%2FP%3E%0A%3CH3%20id%3D%22wrapping-up%22%20id%3D%22toc-hId-784905496%22%20id%3D%22toc-hId-784909396%22%20id%3D%22toc-hId-784909396%22%20id%3D%22toc-hId-784909396%22%20id%3D%22toc-hId-784909396%22%3EWrapping%20up%3C%2FH3%3E%0A%3CP%3EIn%20this%20post%20have%20learned%20how%2C%20thanks%20to%20a%20new%20feature%20added%20in%20Visual%20Studio%202019%2016.1%2C%20we%20can%20combine%20the%20best%20of%20both%20worlds%20when%20it%20comes%20to%20support%20the%20App%20Installer%20technology%3A%20the%20easiness%20of%20automatically%20generating%20an%20.appinstaller%20file%20as%20part%20of%20the%20package%20creation%20process%20and%20the%20flexibility%20of%20the%20new%20update%20features%20added%20in%20Windows%2010%201903.%3C%2FP%3E%0A%3CP%3EHappy%20packaging!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-740717%22%20slang%3D%22en-US%22%3ERe%3A%20Introducing%20the%20new%20App%20Installer%20template%20in%20Visual%20Studio%202019%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-740717%22%20slang%3D%22en-US%22%3E%3CP%3EWrap%20up%2C%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-741475%22%20slang%3D%22en-US%22%3ERe%3A%20Introducing%20the%20new%20App%20Installer%20template%20in%20Visual%20Studio%202019%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-741475%22%20slang%3D%22en-US%22%3E%3CP%3Ethat%20is%20great%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-899779%22%20slang%3D%22en-US%22%3ERe%3A%20Introducing%20the%20new%20App%20Installer%20template%20in%20Visual%20Studio%202019%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-899779%22%20slang%3D%22en-US%22%3EWill%20make%20the%20installation%20creation%20process%20simpler.%3C%2FLINGO-BODY%3E
Microsoft

n the lasts months we have learned, here in this blog, how App Installer can help you distribute MSIX packages and keep them automatically updated without using the Store. First, we have learned how to generate such a file with Visual Studio and the wizard to create MSIX packages starting from a UWP project or a Windows Application Packaging Project. Then, in another post we have learned how Windows 10 1903 has introduced some highly requested features, like the ability to declare an update as critical or to show a prompt to the user to notify him that an update is available.

Unfortunately, until a while ago, there wasn't the chance to combine both these features in an easy way. When you start the wizard to generate a MSIX package and you opt-in for sideloading with auto updates, you can only specify a few options, like the URL where the package will be published and the update frequency. What if I want to use one of the new features added in 1903, like adding the ShowPrompt attribute to trigger the update notification? Right now, the only solution is to manually edit the .appinstaller file generated by Visual Studio after the package creation process has been completed. This approach is hard to maintain, especially if you're planning to leverage an agile approach and setup a CI/CD pipeline to automatically build and deploy your applications. You would need to add to add a task in your pipeline which manipulates the .appinstaller file and manually add the required attributes.

Starting from Visual Studio 2019 16.1, instead, there's a better solution: the App Installer template. Thanks to this template, which can be added inside a UWP or Windows Application Packaging Project, you can define the look & feel of the App Installer file and set some of the information as parameters, which will be automatically replaced by the real values during the package generation.

Let's see an example.

Add an App Installer template

Let's assume that we have a Win32 application packaged with the Windows Application Packaging Project, as in the following image:

wapp.png

Right click on the Windows Application Packaging Project and choose Add → New item. Among the available templates, you will find a new one called App Installer.

 

template.png

Give it a name. The new file, with .appinstaller extension, will be included inside the project and it will look like this:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller Uri="{AppInstallerUri}"
              Version="{Version}"
              xmlns="http://schemas.microsoft.com/appx/appinstaller/2018">

  <MainBundle Name="{Name}"
              Version="{Version}"
              Publisher="{Publisher}"
              Uri="{MainPackageUri}"/>

  <UpdateSettings>
    <OnLaunch HoursBetweenUpdateChecks="0" />
  </UpdateSettings>

</AppInstaller>

As you can see, all the information which are dynamic and which are dependent by the package configuration are included with a placeholder, wrapped inside graphs. All these values will be replaced with the ones from the manifest and from the project's configuration during the package creation wizard.

Which is the advantage of this approach? Let's say that we want to leverage the new feature to display a notification to the user when he opens the application and an update is available. We just need to add the ShowPrompt attribute to the OnLaunch entry, as in the following example:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller Uri="{AppInstallerUri}"
              Version="{Version}"
              xmlns="http://schemas.microsoft.com/appx/appinstaller/2018">

  <MainBundle Name="{Name}"
              Version="{Version}"
              Publisher="{Publisher}"
              Uri="{MainPackageUri}"/>

  <UpdateSettings>
    <OnLaunch HoursBetweenUpdateChecks="0" ShowPrompt="true" />
  </UpdateSettings>

</AppInstaller>

From now on, when we're going to generate a new package, all the parameters will be replaced with the real value, but the new ShowPrompt attribute, being fixed, will stay as it is.

Let's generate a package to test this. Right click on the Windows Application Packaging Project, choose Store → Create app packages and then, in the first screen, choose Sideloading and leave the option Enable automatic updates turned on. In the next step, choose the package configuration as usual, then hit Next. Now you will notice something different. You will still be able to configure the URL where you're going to deploy the package (which will be used to replace the {AppInstallerUri} parameter in the App Installer template), but you won't be able to configure the update frequency anymore. Additionally, the screen will display a warning that an App Installer template has been detected. Since now the update policies are controlled by the App Installer template, you don't need to set them anymore during the wizard. Actually, this is a good thing because the wizard doesn't support the new features introduced in Windows 10 1903, so the template gives you more flexibility.

sideloading.png

That's it. Now generate the package and, at the end of the process, you will see that the App Installer file will have retained the custom update frequency, but all the other values will have been replaced with the real ones which belong to your app:

<?xml version="1.0" encoding="utf-8"?>
<AppInstaller
	Uri="https://db-msixtest.azurewebsites.net/ContosoExpenses.Package.appinstaller"
	Version="1.0.5.0" xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2">
	<MainBundle
		Name="ContosoExpenses"
		Version="1.0.5.0"
		Publisher="CN=Matteo Pagani, O=Matteo Pagani, L=Como, S=Como, C=IT"
		Uri="https://db-msixtest.azurewebsites.net/ContosoExpenses.Package_1.0.5.0_Test/ContosoExpenses.Package_1.0.5.0_x86.msixbundle" />
	<UpdateSettings>
		<OnLaunch
			HoursBetweenUpdateChecks="0"
			ShowPrompt="True" />
	</UpdateSettings>
</AppInstaller>

App Installer and Azure DevOps

If you have a CI/CD pipeline for your desktop application hosted on Azure DevOps, there's a good news! The latest image for the Windows hosted agent includes Visual Studio 2019 16.1, so you can leverage the App Installer template also in your pipeline. It's enough to use, as Windows image, the one called windows-2019, as described in the documentation. This way you'll be able to automatically deploy on a website the MSIX package and the custom App Installer file, without having to manually change it to support the new features added in Windows 10 1903.

Wrapping up

In this post have learned how, thanks to a new feature added in Visual Studio 2019 16.1, we can combine the best of both worlds when it comes to support the App Installer technology: the easiness of automatically generating an .appinstaller file as part of the package creation process and the flexibility of the new update features added in Windows 10 1903.

Happy packaging!

3 Comments
Contributor

Wrap up, :)

New Contributor

that is great 

 

Contributor
Will make the installation creation process simpler.