Home
%3CLINGO-SUB%20id%3D%22lingo-sub-316512%22%20slang%3D%22en-US%22%3EDesktop%20Bridge%20-%20Converting%20an%20installer%20with%20Desktop%20App%20Converter%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-316512%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Oct%2017%2C%202016%20%3C%2FSTRONG%3E%3CBR%20%2F%3EHopefully%2C%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fappconsult%2F2016%2F10%2F13%2Fdesktop-bridge-the-bridge-between-win32-apps-and-the-universal-windows-platform%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ethanks%20to%20the%20previous%20post%20%3C%2FA%3E%2C%20you%20have%20now%20a%20better%20picture%20of%20the%20scenario%20where%20the%20Desktop%20Bridge%20fits%3A%20it%20helps%20Win32%20developers%20to%20start%20moving%20their%20first%20steps%20in%20the%20UWP%20world%20and%20getting%20benefits%20of%20some%20of%20his%20advantages%2C%20without%20having%20to%20rewrite%20the%20app%20from%20scratch.%20In%20this%20article%20we%E2%80%99ll%20start%20to%20have%20some%20fun%20and%20to%20be%20more%20technical%3A%20we%E2%80%99re%20going%20to%20take%20an%20existing%20installer%20(a%20MSI%20file)%20and%20we%E2%80%99re%20going%20to%20convert%20it%20into%20an%20AppX%20package%20using%20the%20Desktop%20App%20Converter%2C%20which%20is%20one%20of%20the%20available%20tools%20that%20are%20part%20of%20the%20Desktop%20Bridge.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-1477804992%22%20id%3D%22toc-hId-1599710593%22%3EInstalling%20the%20Desktop%20App%20Converter%3C%2FH3%3E%3CBR%20%2F%3E%20The%20first%20step%20is%20to%20make%20sure%20your%20computer%20is%20up-to-date%20with%20the%20latest%20Windows%2010%20version%3A%20Desktop%20App%20Converter%2C%20in%20fact%2C%20requires%20the%20Anniversary%20Update%2C%20which%20was%20released%20on%202%20%3CSUP%3End%20%3C%2FSUP%3EAugust.%20To%20make%20sure%20you%E2%80%99re%20on%20the%20right%20version%2C%20just%20right%20click%20on%20the%20Start%20button%20and%20choose%20Command%20Prompt%3A%20at%20the%20top%2C%20you%E2%80%99ll%20see%20the%20Windows%2010%20build%20number%2C%20which%20should%20be%20%3CB%3E10.0.14393.%20%3C%2FB%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66692iAF70E0A20FF3EBE2%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20haven%E2%80%99t%20received%20yet%20the%20Anniversary%20Update%20and%20you%20have%20a%20Windows%20Home%20or%20Pro%20edition%2C%20there%E2%80%99s%20an%20easy%20way%20to%20get%20it%3A%20got%20to%20the%20website%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fsoftware-download%2Fwindows10%22%20title%3D%22https%3A%2F%2Fwww.microsoft.com%2Fsoftware-download%2Fwindows10%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fsoftware-download%2Fwindows10%20%3C%2FA%3E%2C%20click%20%3CSTRONG%3EUpgrade%20now%20%3C%2FSTRONG%3Eand%20launch%20that%20tool%20that%20you%20will%20be%20prompted%20to%20download.%20It%20will%20take%20care%20of%20%E2%80%9Cforcing%E2%80%9D%20the%20installation%20of%20the%20Anniversary%20Update%20if%20your%20PC%20is%20still%20on%20the%20November%20version.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Now%20you%20need%20to%20get%20two%20files%3A%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EThe%20Desktop%20App%20Converter%20tool%20itself%2C%20which%20can%20be%20downloaded%20directly%20from%20the%20Store%20at%20the%20URL%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fstore%2Fapps%2F9nblggh4skzw%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fstore%2Fapps%2F9nblggh4skzw%3C%2FA%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EThe%20base%20Windows%20image%2C%20which%20is%20used%20as%20container%20to%20generate%20the%20AppX%20package%20(%20%3CB%3EBaseImage-14393.wim%20%3C%2FB%3E).%20Be%20aware%20that%20this%20file%20is%20quite%20big%20(approximately%203.3%20GB).%20It%20can%20be%20downloaded%20from%20the%20following%20link%3A%20%3CA%20href%3D%22http%3A%2F%2Faka.ms%2Fconverterimages%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Faka.ms%2Fconverterimages%20%3C%2FA%3E.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20%3CB%3EImportant!%20%3C%2FB%3EEach%20Windows%20build%20needs%20to%20have%20a%20matching%20base%20image%20for%20the%20Desktop%20App%20Converter.%20As%20such%2C%20if%20you%20want%20to%20do%20some%20serious%20work%20with%20the%20Desktop%20Bridge%2C%20I%20strongly%20suggest%20you%20to%20keep%20a%20PC%20or%20a%20Virtual%20Machine%20with%20the%20Anniversary%20Update%20dedicated%20just%20to%20this%20task.%20The%20reason%20is%20that%2C%20if%20you%E2%80%99re%20interested%20in%20testing%20the%20new%20Windows%2010%20previews%20that%20are%20being%20released%20through%20the%20Insider%20program%2C%20the%20Desktop%20Bridge%20team%20doesn%E2%80%99t%20release%20a%20base%20image%20for%20each%20new%20build%20that%20gets%20released%2C%20especially%20if%20you%E2%80%99re%20subscribed%20to%20the%20Fast%20Ring.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Once%20you%20have%20downloaded%20the%20base%20image%20and%20installed%20the%20application%20from%20the%20Store%2C%20you%20need%20to%20launch%20it%20with%20administrative%20rights%20(so%20right%20click%20on%20the%20Desktop%20App%20Converter%20icon%20and%20choose%20%3CB%3ERun%20as%20administrator%20%3C%2FB%3E).%20Under%20the%20hood%2C%20you%20will%20notice%20that%20it%E2%80%99s%20simply%20a%20Powershell%20command%20prompt%2C%20since%20it%E2%80%99s%20the%20technology%20that%20empowers%20the%20Desktop%20App%20Converter.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66694iBC79381251B6A624%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20first%20step%20is%20to%20bypass%20the%20standard%20Windows%20execution%20policies%2C%20otherwise%20you%20won%E2%80%99t%20be%20able%20to%20move%20on%20with%20the%20installation%2C%20by%20executing%20the%20following%20command%3A%20%3CBR%20%2F%3EPS%20C%3A%5C%26gt%3B%20Set-ExecutionPolicy%20bypass%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20next%20step%20is%20to%20install%20the%20base%20image%2C%20by%20executing%20the%20following%20command%20in%20the%20folder%20where%20you%20have%20copied%20the%20file%20you%E2%80%99ve%20previously%20downloaded%20(or%2C%20alternatively%2C%20you%20can%20pass%20to%20the%20%3CB%3E-BaseImage%20%3C%2FB%3Eparameter%20the%20full%20path%20of%20the%20file).%20%3CBR%20%2F%3E%20PS%20C%3A%5C%26gt%3B%20DesktopAppConverter.exe%20-Setup%20-BaseImage%20%22.%5CBaseImage-14393.wim%22%20-Verbose%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20operation%20will%20take%20a%20while%20and%2C%20at%20some%20point%2C%20it%20may%20ask%20you%20to%20reboot%20the%20machine%3A%20the%20reason%20is%20that%20Desktop%20App%20Converter%20relies%20on%20a%20Windows%2010%20features%20(called%20Containers)%2C%20which%20isn%E2%80%99t%20installed%20by%20default.%20If%20that%E2%80%99s%20the%20case%2C%20the%20script%20will%20take%20care%20of%20installing%20it%20for%20you%20and%20rebooting%20the%20machine%20to%20enable%20it.%20If%20that%20doesn%E2%80%99t%20happen%20and%20you%20get%20an%20error%20related%20to%20the%20inability%20of%20properly%20install%20the%20Containers%20support%2C%20you%20can%20manually%20install%20the%20feature%20by%20right%20clicking%20on%20the%20Start%20button%2C%20choosing%20%3CB%3EPrograms%20and%20features%20%3C%2FB%3Eand%2C%20in%20the%20left%20panel%2C%20the%20option%20%3CB%3ETurn%20Windows%20features%20on%20or%20off.%20%3C%2FB%3E%20You%20will%20find%20one%20called%20%3CB%3EContainers%20%3C%2FB%3E%3A%20enable%20it%2C%20let%20the%20installation%20complete%20and%2C%20if%20asked%2C%20reboot%20the%20computer.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66696iA97CFB112EC072DD%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CB%3EPlease%20note!%20%3C%2FB%3EThe%20Containers%20feature%20is%20available%20only%20on%20Windows%2010%20Pro%20or%20Enterprise.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20To%20perform%20the%20conversion%20process%2C%20you%E2%80%99ll%20need%20also%20the%20Windows%2010%20SDK%2014393%20installed%20on%20your%20machine%3A%20the%20easiest%20way%20to%20get%20it%20is%20to%20install%20Visual%20Studio%202015%20Update%203%20and%20to%20make%20sure%20to%20perform%20a%20custom%20setup%2C%20so%20that%20you%20get%20the%20chance%20to%20install%20the%20tools%20to%20develop%20Universal%20Windows%20Platform%20applications.%20If%20you%20don%E2%80%99t%20have%20a%20MSDN%20subscription%2C%20you%20can%20get%20the%20free%20Community%20edition%20from%20%3CA%20href%3D%22https%3A%2F%2Fwww.visualstudio.com%2Fproducts%2Fvisual-studio-community-vs%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.visualstudio.com%2Fproducts%2Fvisual-studio-community-vs%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20you%E2%80%99re%20all%20set%20and%20you%E2%80%99re%20ready%20to%20convert%20your%20first%20application.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1074351969%22%20id%3D%22toc-hId--952446368%22%3EStarting%20the%20conversion%20process%3C%2FH3%3E%3CBR%20%2F%3E%20Before%20explaining%20the%20details%20of%20the%20conversion%20process%2C%20it%E2%80%99s%20important%20to%20highlight%20a%20concept%20that%2C%20at%20a%20first%20glance%2C%20it%20may%20not%20be%20immediate%20to%20understand.%20The%20Desktop%20App%20Converter%20tool%20is%20required%20%3CB%3Eonly%20if%20you%20need%20to%20convert%20an%20installer%20(like%20a%20MSI)%20into%20an%20AppX%20package%20%3C%2FB%3E.%20If%20you%E2%80%99re%20starting%20from%20a%20standalone%20executable%20or%20your%20goal%20is%20to%20convert%20a%20project%20for%20which%20you%20have%20the%20source%20code%20(like%20a%20WPF%20or%20Windows%20Forms%20solution%20for%20Visual%20Studio)%2C%20you%20don%E2%80%99t%20need%20the%20Desktop%20App%20Converter%20or%20to%20follow%20the%20steps%20I%E2%80%99m%20going%20to%20describe%20in%20this%20article.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Typically%2C%20the%20approach%20I%E2%80%99m%20going%20to%20show%20in%20the%20next%20steps%20is%20the%20one%20you%E2%80%99re%20going%20to%20leverage%20when%20you%20aren%E2%80%99t%20ready%20to%20start%20adding%20new%20features%20to%20your%20app%20or%20integrating%20UWP%20APIs%20yet%2C%20but%20you%20just%20want%20to%20take%20your%20existing%20installer%20and%20to%20start%20getting%20advantage%20of%20the%20benefits%20of%20the%20AppX%20distribution%20(more%20secure%20sandbox%2C%20more%20streamlined%20installation%20and%20uninstallation%20process%2C%20Store%20distribution%2C%20etc.).%20In%20the%20next%20articles%2C%20instead%2C%20we%E2%80%99re%20going%20to%20see%20the%20other%20approaches%20to%20start%20adding%20UWP%20features%20or%20components%20to%20your%20own%20code%2C%20but%20they%20won%E2%80%99t%20require%20to%20use%20the%20Desktop%20App%20Converter%2C%20but%20just%20the%20standard%20tools%20provided%20by%20the%20Desktop%20Bridge.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20To%20demo%20the%20conversion%20process%2C%20we%20could%20use%20any%20installer%2C%20like%20a%20.msi%20or%20a%20.exe%20setup%20file.%20It%E2%80%99s%20important%2C%20however%2C%20that%20the%20installer%20follows%20the%20requirements%20highlighted%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fappconsult%2F2016%2F10%2F13%2Fdesktop-bridge-the-bridge-between-win32-apps-and-the-universal-windows-platform%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ein%20the%20previous%20article%20%3C%2FA%3E(like%20that%20it%20needs%20to%20support%20a%20silent%20install%20mode%2C%20without%20user%20interaction%2C%20or%20that%20it%20doesn%E2%80%99t%20require%20to%20install%20Windows%20services%20or%20kernel%20drivers).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20For%20this%20demo%2C%20we%E2%80%99re%20going%20to%20use%20a%20very%20simple%20Windows%20Forms%20application%20I%E2%80%99ve%20created%20called%20%3CB%3EHello%20Centennial%20%3C%2FB%3E%2C%20which%20does%20a%20very%20a%20simple%20operation%20that%20a%20standard%20UWP%20app%20can%E2%80%99t%20perform%3A%20creating%20a%20text%20file%20on%20the%20user%E2%80%99s%20desktop%20without%20asking%20for%20his%20explicit%20permission.%20If%20you%20want%20to%20take%20a%20look%20at%20the%20source%20code%2C%20the%20project%20available%20on%20GitHub%2C%20as%20every%20other%20sample%20related%20to%20this%20series%20of%20articles%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Ftree%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial%22%20title%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Ftree%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Ftree%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20code%20is%20quite%20straightforward%3A%20the%20main%20form%20contains%20a%20button%20that%2C%20when%20it%E2%80%99s%20clicked%2C%20creates%20a%20file%20on%20the%20user%E2%80%99s%20desktop%20with%20a%20message.%20%3CBR%20%2F%3E%20private%20void%20OnCreateFile(object%20sender%2C%20EventArgs%20e)%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3Estring%20userPath%20%3D%20Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)%3B%20%3CBR%20%2F%3Estring%20fileName%20%3D%20%24%22%7BuserPath%7D%5C%5Ccentennial.txt%22%3B%20%3CBR%20%2F%3EFile.WriteAllText(fileName%2C%20%22This%20file%20has%20been%20created%20by%20a%20Centennial%20app%22)%3B%20%3CBR%20%2F%3E%7D%20%3CBR%20%2F%3E%3CBR%20%2F%3EBy%20using%20a%20third%20party%20application%20I%E2%80%99ve%20converted%20the%20.exe%20produced%20by%20Visual%20Studio%20into%20an%20.msi%20installer%2C%20which%20respects%20the%20Desktop%20App%20Converter%20requirements%3A%20it%20doesn%E2%80%99t%20try%20to%20install%20services%20or%20drivers%2C%20it%E2%80%99s%20a%20MSI%20(so%20it%20has%20built-in%20support%20for%20silent%20installation)%2C%20etc.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20You%20can%20download%20the%20.msi%20from%20GitHub%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Fblob%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial.msi%22%20title%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Fblob%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial.msi%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%2Fblob%2Fmaster%2F1.%2520Desktop%2520App%2520Converter%2FHelloCentennial.msi%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20that%20we%20have%20a%20MSI%20to%20play%20with%2C%20we%20can%20start%20the%20conversion%20process%20using%20the%20Desktop%20App%20Converter%20tool.%20We%E2%80%99ll%20need%2C%20again%2C%20to%20open%20the%20tool%20with%20administrative%20privileges.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20This%20is%20the%20command%20we%E2%80%99re%20going%20to%20execute%3A%20%3CBR%20%2F%3EC%3A%5C%26gt%3B.%5CDesktopAppConverter.exe%20-Installer%20%22C%3A%5CInstaller%5CHelloCentennial.msi%22%20-Destination%20%22C%3A%5COutput%5CHelloCentennial%22%20-PackageName%20%22HelloCentennial%22%20-Publisher%20%22CN%3D%3CPUBLISHER_NAME%3E%22%20-Version%20%221.0.0.0%22%20-MakeAppx%20-Verbose%20-Sign%20%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20is%20the%20explanation%20of%20the%20different%20parameters%20required%20by%20the%20script%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Installer%20%3C%2FB%3Eis%20the%20path%20to%20the%20setup%20file%20we%20need%20to%20convert.%20In%20this%20case%2C%20it%E2%80%99s%20the%20%3CB%3EHelloCentennial.msi%20%3C%2FB%3Efile%20we%E2%80%99ve%20previously%20downloaded%20from%20GitHub.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Destination%20%3C%2FB%3Eis%20the%20folder%20where%20we%20want%20to%20store%20the%20output%20files%20created%20by%20the%20conversion%20process.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-PackageName%20%3C%2FB%3Eis%20the%20name%20we%20want%20to%20give%20to%20the%20package.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Publisher%20%3C%2FB%3Eis%20the%20publisher%E2%80%99s%20name%20of%20the%20application.%20If%20you%20have%20some%20previous%20experience%20with%20UWP%20development%2C%20you%E2%80%99ll%20recall%20seeing%20this%20information%20in%20the%20manifest%20file%20of%20a%20UWP%20app.%20It%E2%80%99s%20univocally%20assigned%20by%20the%20Dev%20Center%20when%20you%20open%20a%20developer%20account.%20For%20the%20moment%2C%20for%20test%20purposes%2C%20you%20can%20just%20use%20the%20name%20you%20want%2C%20it%E2%80%99s%20just%20important%20that%20it%20starts%20with%20%3CB%3ECN%3D%20%3C%2FB%3Eand%20that%20it%20doesn%E2%80%99t%20contain%20spaces.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Version%20%3C%2FB%3Eis%20the%20version%20number%20of%20the%20app.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-MakeAppx%20%3C%2FB%3Emeans%20that%2C%20other%20than%20generating%20the%20folder%20which%20will%20contain%20all%20the%20files%20that%20needs%20to%20be%20packaged%20(like%20assets%2C%20the%20manifest%2C%20etc.)%2C%20you%20want%20also%20to%20immediately%20generate%20the%20AppX%20package.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Verbose%20%3C%2FB%3Eis%20an%20optional%20parameter%2C%20which%20is%20useful%20because%20it%20will%20show%20you%20all%20the%20details%20of%20what%E2%80%99s%20going%20on%20during%20the%20conversion%20process.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-Sign%20%3C%2FB%3Eis%20a%20parameter%20that%20allows%20to%20automatically%20generate%20the%20needed%20certificates%20to%20properly%20sign%20the%20AppX%20package.%20Without%20this%20digital%20signature%2C%20the%20package%20can%E2%80%99t%20be%20installed%20on%20a%20machine%20which%20doesn%E2%80%99t%20trust%20the%20generated%20certificate.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20As%20already%20mentioned%2C%20I%E2%80%99ve%20created%20an%20installer%20using%20the%20MSI%20format%2C%20meaning%20that%20it%20automatically%20supports%20a%20silent%20installation%20process.%20The%20Desktop%20App%20Converter%20is%20able%20to%20automatically%20understand%20it%20and%20apply%20the%20required%20parameters%20to%20perform%20the%20installation%20in%20the%20proper%20way.%20However%2C%20many%20installers%20don%E2%80%99t%20work%20this%20way%3A%20they%2C%20at%20least%2C%20ask%20to%20the%20user%20to%20press%20a%20couple%20of%20Next%20buttons%20to%20move%20on%20with%20the%20process%2C%20to%20choose%20the%20folder%20where%20to%20install%20the%20app%2C%20sometimes%20to%20accept%20a%20license%20agreement%2C%20etc.%20In%20these%20cases%2C%20it%E2%80%99s%20likely%20that%20they%20still%20offer%20a%20silent%20installation%20mode%2C%20but%20they%20require%20to%20be%20launched%20with%20a%20special%20parameter%20(like%20%3CB%3ESetup.exe%20%2Fs%20%3C%2FB%3E).%20If%20that%E2%80%99s%20your%20case%2C%20you%20can%20specify%20this%20information%20with%20an%20additional%20parameter%20provided%20by%20the%20Desktop%20App%20Converter%20called%20%3CB%3E-InstallerArguments.%20%3C%2FB%3E%20In%20this%20case%2C%20for%20example%2C%20the%20previous%20command%20would%20look%20like%20this%3A%20%3CBR%20%2F%3EC%3A%5C%26gt%3B.%5CDesktopAppConverter.exe%20-Installer%20%22C%3A%5CInstaller%5CSetup.exe%22%20-Destination%20%22C%3A%5COutput%5CHelloCentennial%22%20-PackageName%20%22HelloCentennial%22%20-Publisher%20%22CN%3D%3CPUBLISHER_NAME%3E%22%20-Version%20%221.0.0.0%22%20-MakeAppx%20-Verbose%20-Sign%20-InstallerArguments%20%22%2Fs%22%20%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20happens%20during%20the%20conversion%20process%3F%20The%20tool%20will%20capture%20all%20the%20changes%20made%20by%20the%20setup%20during%20the%20installation%20(file%20copied%2C%20registry%20keys%20created%2C%20etc.)%20and%20will%20store%20them%2C%20so%20that%20they%20can%20be%20replicated%20in%20the%20sandbox%20when%20the%20app%20is%20executed%20into%20the%20container.%20This%20is%20the%20reason%20why%20apps%20distributed%20using%20AppX%20are%20more%20secure%3A%20all%20the%20reading%20operations%20will%20be%20performed%20against%20the%20real%20registry%2C%20but%20all%20the%20writing%20ones%20will%20be%20performed%20against%20a%20virtualized%20version.%20The%20isolated%20container%20will%20take%20care%20of%20merging%20the%20real%20registry%20with%20the%20virtualizing%20one%2C%20allowing%20your%20app%20to%20always%20work%20with%20a%20consistent%20and%20up-to-date%20version%20of%20the%20registry.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20consequence%20is%20that%2C%20when%20your%20app%20will%20be%20uninstalled%2C%20it%20will%20be%20like%20uninstalling%20a%20UWP%20app%3A%20there%20won%E2%80%99t%20be%20any%20leftover%2C%20neither%20in%20the%20file%20system%20or%20in%20the%20registry%2C%20which%20has%20always%20been%20one%20of%20the%20biggest%20causes%20of%20the%20Windows%20degrading%20performance%20issue%20over%20time.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20At%20the%20end%20of%20the%20process%2C%20you%20will%20get%20a%20folder%20structure%20like%20the%20following%20one%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66698iDB63B830795685D4%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20real%20work%20done%20by%20the%20tool%20can%20be%20found%20inside%20the%20%3CB%3EPackageFiles%20%3C%2FB%3Efolder%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66700iCCD173A0F44268A7%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20you%20can%20see%2C%20this%20folder%20looks%20a%20bit%20like%20the%20one%20that%20Visual%20Studio%20creates%20when%20you%20start%20a%20new%20UWP%20project.%20You%20have%20an%20%3CB%3EAssets%20%3C%2FB%3Efolder%2C%20which%20contains%20the%20default%20images%20to%20be%20used%20for%20the%20tile%2C%20the%20Store%20or%20the%20icon%20in%20the%20Start%20menu.%20You%20have%20also%20a%20manifest%20file%2C%20the%20one%20called%20%3CB%3EAppxManifest.xml%20%3C%2FB%3E%3A%20if%20you%20open%20it%20with%20a%20text%20editor%2C%20you%20will%20notice%20that%20it%E2%80%99s%20similar%20to%20the%20manifest%20file%20of%20a%20UWP%20app.%20However%2C%20compared%20to%20a%20native%20UWP%20app%2C%20you%E2%80%99ll%20find%20a%20couple%20of%20differences%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EYou%E2%80%99ll%20find%20the%20following%20capability%2C%20which%20allows%20the%20application%20to%20run%20in%20full%20trust.%20This%20option%20is%20available%20only%20for%20converted%20apps%2C%20a%20native%20UWP%20apps%20can%E2%80%99t%20have%20this%20kind%20of%20access.%20%3CBR%20%2F%3E%20%3CCAPABILITIES%3E%20%3CBR%20%2F%3E%3CCAPABILITY%20name%3D%22%26quot%3BrunFullTrust%26quot%3B%22%3E%3C%2FCAPABILITY%3E%20%3CBR%20%2F%3E%3C%2FCAPABILITIES%3E%20%3CBR%20%2F%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EYou%E2%80%99ll%20find%20an%20%3CB%3EApplication%20%3C%2FB%3Eentry%20with%20all%20the%20info%20about%20the%20Win32%20process%20that%20the%20UWP%20container%20will%20launch%3A%20%3CBR%20%2F%3E%3CAPPLICATION%20id%3D%22%26quot%3BHelloCentennial%26quot%3B%22%20executable%3D%22%26quot%3BHelloCentennial.exe%26quot%3B%22%20entrypoint%3D%22%26quot%3BWindows.FullTrustApplication%26quot%3B%22%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FAPPLICATION%3E%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20Additionally%2C%20you%E2%80%99ll%20find%20other%20files%20and%20folders%20that%20captured%20the%20MSI%20setup%20process.%20For%20example%2C%20the%20%3CB%3ERegistry.dat%20%3C%2FB%3Efile%20contains%20all%20the%20changes%20applied%20to%20the%20registry.%20Or%2C%20if%20you%20explore%20the%20%3CB%3EVFS%20%3C%2FB%3Efolder%2C%20you%20will%20find%20all%20the%20dependencies%20that%20are%20copied%20during%20the%20installation%20process%20(like%20the%20entry%20in%20the%20Start%20Menu).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Since%2C%20in%20the%20Desktop%20App%20Converter%20command%2C%20we%E2%80%99ve%20added%20the%20%3CB%3E-MakeAppx%20%3C%2FB%3Eparameter%2C%20the%20tool%20has%20already%20generated%20for%20us%20an%20AppX%20package%20starting%20from%20the%20%3CB%3EPackageFiles%20%3C%2FB%3Efolder%2C%20which%20we%20can%20deploy%20and%20share%20with%20other%20users%20or%2C%20eventually%2C%20publish%20on%20the%20Store%20when%20we%E2%80%99ll%20be%20granted%20access.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20You%20can%20immediately%20see%20one%20of%20the%20new%20features%20of%20the%20Anniversary%20Update%20we%E2%80%99ve%20talked%20about%20%3CA%20href%3D%22https%3A%2F%2Fblogs.msdn.microsoft.com%2Fappconsult%2F2016%2F10%2F13%2Fdesktop-bridge-the-bridge-between-win32-apps-and-the-universal-windows-platform%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ein%20the%20previous%20post%20%3C%2FA%3E%3A%20in%20the%20past%2C%20to%20manually%20install%20an%20AppX%20package%20without%20using%20the%20Store%2C%20you%20needed%20to%20run%20a%20Powershell%20script.%20Now%2C%20instead%2C%20you%20have%20a%20simple%20visual%20installer%3A%20just%20double%20click%20on%20the%20file%20%3CB%3EHelloCentennial.appx%20%3C%2FB%3Eand%20you%E2%80%99ll%20be%20prompted%20with%20the%20following%20dialog%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66702i7D3C3F91907F18B4%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20if%20you%20press%20the%20Install%20button%20out%20of%20the%20box%2C%20you%E2%80%99ll%20stumble%20upon%20the%20following%20error%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66703i19ECAF8239AB4810%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20reason%20is%20that%2C%20by%20default%2C%20a%20UWP%20package%20needs%20to%20be%20signed%20with%20a%20valid%20certificate%20to%20be%20installed%20and%20this%20certificate%20needs%20to%20be%20trusted%20by%20the%20computer.%20When%20we%20publish%20a%20UWP%20app%20on%20the%20Store%2C%20this%20process%20is%20completely%20transparent%3A%20it%E2%80%99s%20the%20Store%20that%20takes%20care%20of%20signing%20the%20AppX%20package%20with%20a%20valid%20certificate%20during%20the%20submission%20process.%20In%20this%20case%2C%20instead%2C%20we%E2%80%99re%20trying%20to%20sideload%20a%20package%20without%20using%20the%20Store%2C%20so%20we%20need%20to%20take%20care%20of%20signing%20it.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20remember%2C%20when%20we%20used%20the%20Desktop%20App%20Converter%20tool%2C%20we%20passed%20a%20parameter%20called%20-%20%3CB%3ESign%20%3C%2FB%3E%2C%20which%20already%20did%20the%20hard%20work%20for%20us.%20The%20package%20is%20already%20signed%3A%20the%20problem%20is%20that%20the%20certificate%20used%20for%20signing%20it%2C%20at%20the%20moment%2C%20isn%E2%80%99t%20trusted%20by%20our%20computer%2C%20which%20leads%20to%20an%20installation%20failure.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20To%20solve%20this%20problem%2C%20you%E2%80%99ll%20need%20to%20add%20the%20certificate%20in%20the%20%3CB%3ETrusted%20Root%20Certification%20Authority%20%3C%2FB%3Eof%20the%20computer.%20You%E2%80%99ll%20find%20it%20in%20the%20folder%20generated%20by%20the%20tool%20(the%20one%20with%20the%20AppX%20package%20and%20the%20%3CB%3EPackageFiles%20%3C%2FB%3Efolder)%20and%20it%E2%80%99s%20called%20%3CB%3Eauto-generated.cer%3A%20%3C%2FB%3Esimply%20double%20click%20on%20it%2C%20choose%20%3CB%3EInstall%20certificate%20%3C%2FB%3Eand%2C%20when%20you%E2%80%99re%20prompted%20where%20to%20install%20it%2C%20choose%20%3CB%3ELocal%20machine%20%3C%2FB%3Eand%20then%20the%20option%20%3CB%3EPlace%20all%20certificates%20in%20the%20following%20store%20%3C%2FB%3E.%20By%20pressing%20the%20%3CB%3EBrowse%20%3C%2FB%3Ebutton%2C%20make%20sure%20to%20choose%20%3CB%3ETrusted%20Root%20Certification%20Authorities%20%3C%2FB%3Eand%20complete%20the%20process.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66705i385573CB0C78AAEA%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20After%20you%E2%80%99ve%20completed%20this%20operation%2C%20you%20can%20now%20try%20again%20to%20install%20the%20AppX%20file.%20This%20time%2C%20after%20pressing%20the%20%3CB%3EInstall%20%3C%2FB%3Ebutton%2C%20you%20will%20see%20a%20progress%20bar%20showing%20the%20installation%20status%20and%2C%20at%20the%20end%2C%20the%20window%20will%20become%20like%20the%20following%20one%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66707iCDD5E374CA301750%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20you%20have%20a%20Win32%20app%20that%20has%20been%20embedded%20into%20a%20UWP%20app!%20If%20you%20look%20for%20it%20in%20the%20Start%20menu%2C%20you%20will%20see%20it%20like%20any%20other%20native%20UWP%20app%3A%20it%20will%20have%20a%20tile%20(even%20if%20a%20standard%20one%20generated%20by%20the%20tool)%2C%20you%E2%80%99ll%20be%20able%20to%20pin%20it%20to%20the%20Start%20menu%20and%2C%20if%20you%20want%20to%20uninstall%20it%2C%20just%20right%20click%20on%20it%20and%20choose%20Uninstall.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66709iF604D465F5413425%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20However%2C%20if%20you%E2%80%99ll%20launch%20it%2C%20you%20will%20notice%20that%20it%E2%80%99s%20still%20a%20Win32%20app%20and%20it%20will%20be%20able%20to%20create%20a%20text%20file%20on%20the%20user%E2%80%99s%20desktop%20just%20fine%2C%20without%20requiring%20any%20extra%20dialog%20or%20permission.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-668458366%22%20id%3D%22toc-hId-790363967%22%3EThe%20installation%20process%3C%2FH3%3E%3CBR%20%2F%3E%20The%20installation%20of%20a%20converted%20app%20is%20exactly%20the%20same%20of%20a%20native%20UWP%20application.%20The%20content%20of%20an%20AppX%20package%20is%20uncompressed%20into%20the%20folder%20%3CB%3EC%3A%5CProgram%20Files%5CWindowsApps%20%3C%2FB%3Ewhich%2C%20by%20default%2C%20is%20hidden%20and%20it%E2%80%99s%20not%20accessible%20by%20any%20user%20(even%20an%20administrator%20one%2C%20since%20the%20owner%20of%20the%20folder%20is%20a%20system%20user).%20This%20is%20a%20read-only%20folder%20and%20it%E2%80%99s%20the%20consequence%20of%20one%20of%20the%20requirements%20that%20a%20converted%20app%20has%20to%20deal%20with%3A%20the%20application%20can%20only%20read%20data%20from%20this%20folder%2C%20but%20it%20can%E2%80%99t%20write%20any%20file.%20Data%20can%20be%20written%20only%20in%20the%20%3CB%3EAppData%20%3C%2FB%3Efolder%2C%20which%20is%20different%20for%20each%20user%20and%20it%E2%80%99s%20stored%20in%20the%20same%20folder%20where%20native%20UWP%20application%20handle%20the%20local%20storage.%20This%20is%20an%20example%20of%20the%20path%20a%20local%20folder%20for%20a%20converted%20app%3A%20%3CB%3EC%3A%5CUsers%5C%3CUSERNAME%3E%5CAppData%5CLocal%5CPackages%5CD5BA6BCD.OpenLiveWriter_7g8mfyn71hpbp%20%3C%2FUSERNAME%3E%3C%2FB%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CB%3E%3CUSERNAME%3E%20%3C%2FUSERNAME%3E%3C%2FB%3Eis%20the%20name%20of%20your%20Windows%20user%2C%20while%20the%20name%20of%20the%20folder%20(in%20this%20sample%2C%20%3CB%3ED5BA6BCD.OpenLiveWriter_7g8mfyn71hpbp%20%3C%2FB%3E)%20corresponds%20to%20the%20%3CSTRONG%3EPackage%20Family%20Name%20%3C%2FSTRONG%3Eof%20the%20application%20(in%20this%20case%2C%20I%E2%80%99ve%20taken%20as%20example%20is%20the%20converted%20version%20of%20Open%20Live%20Writer%2C%20the%20popular%20blogging%20tool%20which%20has%20been%20used%20to%20write%20this%20post).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20reason%20of%20this%20requirement%20is%20very%20simple%3A%20the%20AppData%20folder%20is%20stored%20inside%20the%20Windows%20space%20assigned%20to%20the%20user%2C%20so%20the%20app%20doesn%E2%80%99t%20require%20any%20administrative%20privilege%20to%20read%20and%20write%20files%20into%20this%20folder.%20The%20same%20scenario%20usually%20doesn%E2%80%99t%20apply%2C%20instead%2C%20to%20the%20folder%20where%20the%20app%20is%20installed.%20For%20example%2C%20one%20of%20the%20most%20popular%20locations%20where%20apps%20are%20installed%2C%20the%20%3CB%3EC%3A%5CProgram%20Files%5C%20%3C%2FB%3Efolder%2C%20is%20outside%20the%20user%E2%80%99s%20space%2C%20so%20it%20requires%20admin%20privileges%20to%20write%20to%20it.%20This%20is%20why%20you%20often%20get%20a%20UAC%20prompt%20during%20the%20setup%20process%20of%20a%20standard%20desktop%20app.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20already%20have%20some%20previous%20experience%20with%20UWP%20development%2C%20this%20isn%E2%80%99t%20something%20new%3A%20they%E2%80%99re%20the%20same%20exact%20folders%20where%20a%20native%20UWP%20app%20stores%20the%20content%20of%20the%20AppX%20file%20(which%20usually%20matches%20with%20the%20content%20of%20the%20Visual%20Studio%20project)%20and%20its%20local%20data.%20%3CB%3E%20%3C%2FB%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Inside%20this%20folder%20you%20will%20find%20a%20subfolder%20called%20%3CB%3EAppData%20%3C%2FB%3E%2C%20which%20is%20where%20the%20local%20app%20data%20folder%20of%20your%20application%20will%20be%20mapped%20to.%20This%20means%20that%2C%20every%20time%20you%20use%20the%20following%20C%23%20code%20to%20get%20access%20to%20the%20local%20app%20data%20folder%3A%20%3CBR%20%2F%3ESystem.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eyour%20application%20will%20get%20a%20reference%20to%20this%20folder.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20A%20native%20Win32%20application%2C%20instead%2C%20creates%20his%20own%20%3CB%3EAppData%20%3C%2FB%3Efolder%20in%20the%20path%20%3CB%3EC%3A%5CUsers%5C%3CUSERNAME%3E%5CAppData%5CLocal%20%3C%2FUSERNAME%3E%3C%2FB%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHowever%2C%20for%20the%20application%20the%20AppData%20path%20will%20be%20completely%20transparent%3A%20no%20matter%20if%20it%E2%80%99s%20running%20as%20native%20or%20as%20converted%2C%20it%20will%20automatically%20access%20to%20the%20correct%20location.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1883698595%22%20id%3D%22toc-hId--1761792994%22%3EUpdating%20the%20converted%20app%3C%2FH3%3E%3CBR%20%2F%3E%20If%20you%20have%20some%20previous%20UWP%20development%20experience%2C%20you%20probably%20already%20hinted%20that%20you%20have%20the%20opportunity%20to%20enhance%20your%20application%20without%20writing%20a%20single%20line%20of%20code%3A%20since%20now%20you%20have%20a%20manifest%20file%2C%20you%20can%20edit%20it%20with%20Visual%20Studio%20or%20a%20text%20editor%20and%20start%20adding%20features%20and%20capabilities%20like%20protocol%20support%2C%20file%20association%2C%20background%20tasks%20declaration%2C%20etc.%20You%20can%20also%20define%20new%20assets%20and%20replace%20the%20existing%20ones%20with%20real%20images%2C%20to%20give%20to%20your%20application%20a%20better%20look%20and%20feel%2C%20exactly%20like%20you%20would%20do%20with%20a%20regular%20UWP%20app.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Additionally%2C%20converted%20applications%20have%20access%20to%20a%20set%20of%20capabilities%20that%20aren%E2%80%99t%20normally%20available%20to%20a%20UWP%20app%2C%20like%20the%20ability%20to%20add%20context%20menu%20entries%20in%20File%20Explorer.%20You%20can%20find%20the%20list%20of%20all%20these%20capabilities%20on%20MSDN%3A%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fporting%2Fdesktop-to-uwp-extensions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fporting%2Fdesktop-to-uwp-extensions%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EA%20real%20world%20example%20of%20this%20scenario%20when%20you%20use%20the%20Desktop%20App%20Converter%20is%20related%20to%20assets%3A%20by%20default%2C%20the%20tool%20generates%20a%20set%20of%20sample%20icons%20(a%20square%20with%20an%20X%20in%20the%20middle)%20that%2C%20of%20course%2C%20will%20need%20to%20be%20replaced%20with%20the%20real%20ones%20from%20your%20application%20before%20sharing%20the%20app%20or%20publishing%20it%20to%20the%20Store.%20To%20achieve%20this%20goal%2C%20it%E2%80%99s%20enough%20to%20change%20the%20content%20of%20the%20%3CB%3EAssets%20%3C%2FB%3Efolder%20and%20replacing%20the%20existing%20images%20with%20the%20real%20ones.%20Additionally%2C%20if%20you%20want%2C%20you%20can%20also%20tailor%20your%20converted%20application%20to%20better%20support%20devices%20with%20high%20DPIs%20and%20high%20resolutions%2C%20by%20creating%20multiple%20version%20of%20the%20same%20image%20at%20different%20resolutions.%20Thanks%20to%20a%20simple%20naming%20convention%2C%20Windows%20will%20automatically%20pick%20the%20proper%20version%20based%20on%20the%20scale%20factor%20assigned%20to%20the%20device.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20By%20default%2C%20you%20need%20to%20provide%20at%20least%20the%20image%20in%20three%20different%20resolutions%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E44x44%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E50x50%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E150x150%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20The%20easiest%20way%20to%20provide%20more%20versions%20of%20the%20assets%20is%20to%20leverage%20a%20Visual%20Studio%20extension%20called%20UWP%20Tile%20Generator%26nbsp%3B(%20%3CA%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dshenchauhan.UWPTileGenerator%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dshenchauhan.UWPTileGenerator%20%3C%2FA%3E).%20After%20you%20have%20installed%20it%2C%20simply%20create%20a%20new%20Universal%20Windows%20Platform%20app%20in%20Visual%20Studio%20(an%20empty%20project%20will%20be%20fine)%20and%20add%2C%20in%20the%20%3CB%3EAssets%20%3C%2FB%3Efolder%2C%20the%20icon%20of%20your%20application%20at%20the%20highest%20possible%20resolution.%20Then%2C%20right%20click%20on%20it%20and%20choose%20the%20option%20%3CB%3EGenerate%20UWP%20tiles.%20%3C%2FB%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66711i13AD2A414B48CC6B%22%20%2F%3E%20%3CB%3E%20%3C%2FB%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Automatically%2C%20the%20extension%20will%20create%2C%20in%20the%20%3CB%3EAssets%20%3C%2FB%3Efolder%20of%20the%20empty%20UWP%20project%2C%20all%20the%20different%20versions%20of%20the%20image%20in%20all%20the%20supported%20resolutions%20and%20scaling%20factors.%20You%20will%20notice%2C%20in%20fact%2C%20that%20all%20the%20images%20will%20have%20the%20same%20base%20name%20(like%20%3CB%3ESquare44x44Logo.png%20%3C%2FB%3E)%20but%20with%20a%20prefix%20before%20the%20file%20extension%2C%20that%20specifies%20the%20scale%20factors%20which%20the%20image%20refers%20to%20(like%20%3CB%3ESquare44x44Logo.scale-200.png%20%3C%2FB%3E).%20This%20way%2C%20Windows%2010%20will%20automatically%20pick%20the%20proper%20version%20of%20the%20image%2C%20based%20on%20the%20resolution%2C%20DPI%20and%20viewing%20distance%20of%20the%20device%20where%20the%20app%20is%20running.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Now%20you%20can%20simply%20copy%20all%20the%20images%20contained%20in%20the%20%3CB%3EAssets%20%3C%2FB%3Efolder%20of%20the%20empty%20UWP%20project%20into%20the%20%3CB%3EAssets%20%3C%2FB%3Efolder%20of%20the%20converted%20app%2C%20replacing%20eventually%20the%20existing%20ones.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--140888260%22%20id%3D%22toc-hId--18982659%22%3ERepackaging%20the%20app%3C%2FH3%3E%3CBR%20%2F%3E%20There%E2%80%99s%20an%20important%20caveat%20to%20remember%3A%20every%20time%20we%20change%20something%20in%20the%20%3CB%3EPackageFiles%20%3C%2FB%3Efolder%20created%20by%20the%20Desktop%20App%20Converter%20tool%20(like%20we%20just%20did%2C%20by%20replacing%20the%20assets)%2C%20the%20AppX%20file%20that%20the%20tool%20has%20generated%20doesn%E2%80%99t%20automatically%20update%20itself%2C%20so%20we%20need%20to%20generate%20a%20new%20AppX%20package%20starting%20from%20the%20updated%20folder.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20fact%2C%20if%20we%20would%20try%20to%20uninstall%20and%20reinstall%20again%20the%20%3CB%3EHelloCentennial.appx%20%3C%2FB%3Epackage%20after%20our%20changes%2C%20we%E2%80%99ll%20notice%20that%20the%20assets%20will%20continue%20to%20be%20the%20old%20ones.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Since%2C%20in%20this%20case%2C%20we%20didn%E2%80%99t%20change%20the%20actual%20code%20of%20the%20Win32%20app%2C%20but%20we%20just%20changed%20the%20package%20content%20(the%20assets%20folder%2C%20in%20this%20case)%2C%20we%20don%E2%80%99t%20have%20to%20go%20through%20the%20whole%20procedure%20of%20converting%20the%20MSI%20into%20an%20AppX%20using%20the%20Desktop%20App%20Converter%20tool%2C%20but%20we%20can%20just%20use%20a%20command%20line%20tool%20provided%20by%20the%20Windows%2010%20SDK%2C%20called%20%3CB%3Emakeappx.exe%20%3C%2FB%3E.%20Do%20you%20remember%20that%2C%20when%20we%20used%20the%20tool%2C%20we%20added%20a%20parameter%20called%20%3CB%3E-MakeAppx%20%3C%2FB%3E%3F%20Under%20the%20hood%2C%20the%20Desktop%20App%20Converter%20used%20this%20tool%20to%20create%20the%20package%20for%20us.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Using%20this%20tool%20is%20quite%20easy%3A%20first%20you%20have%20to%20open%20a%20Visual%20Studio%20Command%20Prompt%20(you%20can%20find%20it%20in%20the%20Start%20menu)%2C%20which%20has%20already%20set%20all%20the%20proper%20paths%20to%20give%20you%20access%20to%20the%20tool%20no%20matter%20which%20folder%20you%20are.%20However%2C%20in%20case%20you%20want%20to%20use%20a%20standard%20command%20prompt%2C%20you%E2%80%99ll%20be%20able%20to%20locate%20the%20%3CB%3Emakeappx.exe%20%3C%2FB%3Efile%20in%20the%20following%20folder%3A%20%3CB%3EC%3A%5CProgram%20Files%20(x86)%5CWindows%20Kits%5C10%5Cbin%5Cx64%5C%20%3C%2FB%3E%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20recreate%20the%20AppX%20it%E2%80%99s%20enough%20to%20execute%20the%20following%20command%3A%20%3CBR%20%2F%3Emakeappx%20pack%20-d%20%22C%3A%5COutput%5CHelloCentennial%5CPackageFiles%22%20-p%20%22C%3A%5COutput%5CHelloCentennial%5CHelloCentennial.appx%22%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20required%20parameters%20are%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3Epack%20%3C%2FB%3E%2C%20which%20specifies%20that%20we%20want%20to%20create%20a%20package.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-d%20%3C%2FB%3Eis%20the%20path%20of%20the%20%3CB%3EPackageFiles%20%3C%2FB%3Efolder%20that%20was%20previously%20created%20by%20the%20Desktop%20App%20Converter%20which%20contains%20our%20manifest%2C%20assets%20and%20all%20the%20packaged%20files.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-p%20%3C%2FB%3Eis%20the%20path%20and%20name%20of%20the%20AppX%20file%20we%20want%20to%20create.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20After%20executing%20this%20command%2C%20you%E2%80%99ll%20find%20an%20updated%20AppX%20file%2C%20that%20you%20can%20install%20to%20deploy%20the%20new%20version%20with%20protocol%20support%20on%20your%20computer.%20However%2C%20if%20you%E2%80%99ll%20try%20to%20launch%20it%20you%E2%80%99ll%20find%20another%20surprise%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F66712iB151476435AC8114%22%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20you%20remember%20what%20I%E2%80%99ve%20explained%20earlier%20in%20the%20article%2C%20every%20UWP%20package%20needs%20to%20be%20signed%20(unless%20you%E2%80%99re%20going%20to%20publish%20it%20on%20the%20Store)%3A%20however%2C%20when%20we%20used%20the%20Desktop%20App%20Converter%20for%20the%20first%20time%2C%20we%20didn%E2%80%99t%20need%20to%20take%20care%20of%20this%20operation%2C%20since%20we%20used%20the%20%3CB%3E-Sign%20%3C%2FB%3Eparameter%20which%20did%20all%20the%20hard%20work%20for%20us.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Now%2C%20instead%2C%20since%20we%20have%20manually%20created%20the%20package%2C%20we%20need%20to%20sign%20it%20by%20ourselves%2C%20using%20another%20tool%20provided%20by%20the%20Windows%2010%20SDK%2C%20called%20%3CB%3Esigntool.exe%20%3C%2FB%3E.%20However%2C%20we%20can%20reuse%20the%20certificates%20that%20were%20automatically%20generated%20by%20the%20Desktop%20App%20Converter%20(do%20you%20remember%20the%20files%20called%20%3CB%3Eauto-generated.cer%20%3C%2FB%3Eand%20%3CSTRONG%3Eauto-generated.pfx%20%3C%2FSTRONG%3Ethat%20have%20been%20placed%20in%20the%20output%20directory)%3F%20%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20such%2C%20we%20can%20just%20use%20the%20following%20command%20in%20the%20same%20Visual%20Studio%20command%20prompt%20we%E2%80%99ve%20previously%20used%3A%20%3CBR%20%2F%3Esigntool.exe%20sign%20%2Fa%20%2Fv%20%2Ffd%20SHA256%20%2Ff%20%22C%3A%5COutput%5CHelloCentennial%5Cauto-generated.pfx%22%20%2Fp%20%22123456%22%20%22C%3A%5COutput%5CHelloCentennial%5CHelloCentennial.appx%22%20%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20important%20parameters%20here%20are%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-f%20%3C%2FB%3E%2C%20which%20is%20the%20path%20of%20the%20.pfx%20file%20that%20is%20needed%20to%20sign%20the%20package.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CB%3E-p%20%3C%2FB%3E%2C%20which%20is%20the%20password%20of%20the%20.pfx%20file.%20When%20you%20automatically%20create%20the%20certificate%20using%20the%20%3CB%3E-Sign%20%3C%2FB%3Eoption%20of%20the%20Desktop%20App%20Converter%2C%20the%20generated%20.pfx%20file%20will%20have%20%3CB%3E123456%20%3C%2FB%3Eas%20default%20password.%20This%20parameter%20is%20optional%3A%20if%20you%20decide%20to%20create%20your%20own%20certificate%2C%20in%20fact%2C%20you%20can%20also%20decide%20to%20generate%20it%20without%20any%20password%20protection.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EThe%20last%20parameter%20is%20the%20path%20of%20the%20AppX%20package%20to%20sign%20(the%20one%20we%E2%80%99ve%20previously%20generated%20with%20the%20%3CB%3Emakeappx.exe%20%3C%2FB%3Etool).%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20That%E2%80%99s%20all!%20Now%20you%20should%20be%20able%20to%20properly%20install%20the%20updated%20package%20with%20the%20correct%20assets.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20don%E2%80%99t%20want%20to%20rely%20on%20the%20certificates%20automatically%20generated%20by%20the%20tool%2C%20you%20can%20also%20create%20your%20own%20and%20use%20them%20to%20sign%20the%20package%3A%20the%20procedure%20is%20quite%20simple%20and%20it%E2%80%99s%20described%20in%20this%20article%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fporting%2Fdesktop-to-uwp-signing%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fporting%2Fdesktop-to-uwp-signing%20%3C%2FA%3E.%20This%20is%20the%20best%20approach%20to%20use%20when%20you%20want%20to%20distribute%20the%20application%2C%20for%20example%2C%20in%20an%20enterprise%20environment%20and%20you%20want%20to%20create%20a%20certificate%20that%20will%20be%20shared%20among%20all%20the%20computers%20of%20the%20company.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-1601922075%22%20id%3D%22toc-hId-1723827676%22%3EWrapping%20up%3C%2FH3%3E%3CBR%20%2F%3E%20In%20this%20article%20we%E2%80%99ve%20seen%20how%2C%20starting%20from%20a%20MSI%20installer%2C%20we%E2%80%99ve%20been%20able%20to%20create%20an%20AppX%20package%2C%20keeping%20the%20best%20of%20both%20worlds%3A%20the%20flexibility%20of%20a%20Win32%20app%20and%20the%20better%20security%20and%20distribution%20model%20of%20an%20AppX%20package.%20In%20the%20end%2C%20we%E2%80%99ve%20seen%20how%2C%20since%20what%20we%20get%20is%20simply%20a%20UWP%20package%2C%20we%20can%20start%20tweaking%20the%20app%20without%20writing%20actual%20code%2C%20by%20editing%20the%20manifest%20file%20or%20changing%20the%20default%20assets.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20What%20if%20you%20have%20changed%20something%20not%20just%20in%20the%20package%20definition%2C%20but%20also%20in%20the%20Win32%20application%20(like%20a%20new%20feature%20or%20a%20new%20piece%20of%20code)%3F%20In%20this%20case%2C%20you%20would%20have%20needed%20to%20go%20again%20through%20the%20whole%20conversion%20process%3A%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EGenerating%20a%20MSI%20installer%20starting%20from%20the%20Windows%20Forms%20executable%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ERunning%20the%20Desktop%20App%20Converter%20tool%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ETweak%20again%20the%20manifest%20file%20or%20the%20assets%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20However%2C%20this%20is%20a%20different%20scenario%20than%20the%20one%20we%20have%20previously%20started%20with%3A%20we%20aren%E2%80%99t%20talking%20anymore%20about%20an%20installer%2C%20but%20about%20an%20executable%20or%20an%20app%20for%20which%20we%20own%20the%20source%20code%20and%20that%20we%20want%20to%20update%20it%20and%20turn%20into%20an%20AppX.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20this%20scenario%2C%20Desktop%20App%20Converter%20isn%E2%80%99t%20our%20friend%2C%20but%20we%20need%20to%20use%20a%20different%20approach%2C%20which%20we%E2%80%99re%20going%20to%20see%20in%20the%20next%20article.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Remember%20that%20you%20can%20find%20all%20the%20samples%20described%20in%20this%20article%20and%20in%20the%20next%20ones%20in%20the%20following%20GitHub%20repository%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fqmatteoq%2FDesktopBridge%20%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHappy%20coding!%3C%2FPUBLISHER_NAME%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-316512%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Oct%2017%2C%202016%20Hopefully%2C%20thanks%20to%20the%20previous%20post%2C%20you%20have%20now%20a%20better%20picture%20of%20the%20scenario%20where%20the%20Desktop%20Bridge%20fits%3A%20it%20helps%20Win32%20developers%20to%20start%20moving%20their%20first%20steps%20in%20the%20UWP%20world%20and%20getting%20benefits%20of%20some%20of%20his%20advantages%2C%20without%20having%20to%20rewrite%20the%20app%20from%20scratch.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-316512%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edesktop%20bridge%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EUniversal%20Windows%20Platform%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FPUBLISHER_NAME%3E%3C%2FLINGO-BODY%3E
Microsoft
First published on MSDN on Oct 17, 2016
Hopefully, thanks to the previous post , you have now a better picture of the scenario where the Desktop Bridge fits: it helps Win32 developers to start moving their first steps in the UWP world and getting benefits of some of his advantages, without having to rewrite the app from scratch. In this article we’ll start to have some fun and to be more technical: we’re going to take an existing installer (a MSI file) and we’re going to convert it into an AppX package using the Desktop App Converter, which is one of the available tools that are part of the Desktop Bridge.

Installing the Desktop App Converter


The first step is to make sure your computer is up-to-date with the latest Windows 10 version: Desktop App Converter, in fact, requires the Anniversary Update, which was released on 2 nd August. To make sure you’re on the right version, just right click on the Start button and choose Command Prompt: at the top, you’ll see the Windows 10 build number, which should be 10.0.14393.



If you haven’t received yet the Anniversary Update and you have a Windows Home or Pro edition, there’s an easy way to get it: got to the website https://www.microsoft.com/software-download/windows10 , click Upgrade now and launch that tool that you will be prompted to download. It will take care of “forcing” the installation of the Anniversary Update if your PC is still on the November version.

Now you need to get two files:

  1. The Desktop App Converter tool itself, which can be downloaded directly from the Store at the URL https://www.microsoft.com/store/apps/9nblggh4skzw

  2. The base Windows image, which is used as container to generate the AppX package ( BaseImage-14393.wim ). Be aware that this file is quite big (approximately 3.3 GB). It can be downloaded from the following link: http://aka.ms/converterimages .


Important! Each Windows build needs to have a matching base image for the Desktop App Converter. As such, if you want to do some serious work with the Desktop Bridge, I strongly suggest you to keep a PC or a Virtual Machine with the Anniversary Update dedicated just to this task. The reason is that, if you’re interested in testing the new Windows 10 previews that are being released through the Insider program, the Desktop Bridge team doesn’t release a base image for each new build that gets released, especially if you’re subscribed to the Fast Ring.

Once you have downloaded the base image and installed the application from the Store, you need to launch it with administrative rights (so right click on the Desktop App Converter icon and choose Run as administrator ). Under the hood, you will notice that it’s simply a Powershell command prompt, since it’s the technology that empowers the Desktop App Converter.



The first step is to bypass the standard Windows execution policies, otherwise you won’t be able to move on with the installation, by executing the following command:
PS C:\> Set-ExecutionPolicy bypass

The next step is to install the base image, by executing the following command in the folder where you have copied the file you’ve previously downloaded (or, alternatively, you can pass to the -BaseImage parameter the full path of the file).
PS C:\> DesktopAppConverter.exe -Setup -BaseImage ".\BaseImage-14393.wim" -Verbose

The operation will take a while and, at some point, it may ask you to reboot the machine: the reason is that Desktop App Converter relies on a Windows 10 features (called Containers), which isn’t installed by default. If that’s the case, the script will take care of installing it for you and rebooting the machine to enable it. If that doesn’t happen and you get an error related to the inability of properly install the Containers support, you can manually install the feature by right clicking on the Start button, choosing Programs and features and, in the left panel, the option Turn Windows features on or off. You will find one called Containers : enable it, let the installation complete and, if asked, reboot the computer.



Please note! The Containers feature is available only on Windows 10 Pro or Enterprise.

To perform the conversion process, you’ll need also the Windows 10 SDK 14393 installed on your machine: the easiest way to get it is to install Visual Studio 2015 Update 3 and to make sure to perform a custom setup, so that you get the chance to install the tools to develop Universal Windows Platform applications. If you don’t have a MSDN subscription, you can get the free Community edition from https://www.visualstudio.com/products/visual-studio-community-vs

Now you’re all set and you’re ready to convert your first application.

Starting the conversion process


Before explaining the details of the conversion process, it’s important to highlight a concept that, at a first glance, it may not be immediate to understand. The Desktop App Converter tool is required only if you need to convert an installer (like a MSI) into an AppX package . If you’re starting from a standalone executable or your goal is to convert a project for which you have the source code (like a WPF or Windows Forms solution for Visual Studio), you don’t need the Desktop App Converter or to follow the steps I’m going to describe in this article.

Typically, the approach I’m going to show in the next steps is the one you’re going to leverage when you aren’t ready to start adding new features to your app or integrating UWP APIs yet, but you just want to take your existing installer and to start getting advantage of the benefits of the AppX distribution (more secure sandbox, more streamlined installation and uninstallation process, Store distribution, etc.). In the next articles, instead, we’re going to see the other approaches to start adding UWP features or components to your own code, but they won’t require to use the Desktop App Converter, but just the standard tools provided by the Desktop Bridge.

To demo the conversion process, we could use any installer, like a .msi or a .exe setup file. It’s important, however, that the installer follows the requirements highlighted in the previous article (like that it needs to support a silent install mode, without user interaction, or that it doesn’t require to install Windows services or kernel drivers).

For this demo, we’re going to use a very simple Windows Forms application I’ve created called Hello Centennial , which does a very a simple operation that a standard UWP app can’t perform: creating a text file on the user’s desktop without asking for his explicit permission. If you want to take a look at the source code, the project available on GitHub, as every other sample related to this series of articles: https://github.com/qmatteoq/DesktopBridge/tree/master/1.%20Desktop%20App%20Converter/HelloCenten...

The code is quite straightforward: the main form contains a button that, when it’s clicked, creates a file on the user’s desktop with a message.
private void OnCreateFile(object sender, EventArgs e)
{
string userPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string fileName = $"{userPath}\\centennial.txt";
File.WriteAllText(fileName, "This file has been created by a Centennial app");
}

By using a third party application I’ve converted the .exe produced by Visual Studio into an .msi installer, which respects the Desktop App Converter requirements: it doesn’t try to install services or drivers, it’s a MSI (so it has built-in support for silent installation), etc.

You can download the .msi from GitHub: https://github.com/qmatteoq/DesktopBridge/blob/master/1.%20Desktop%20App%20Converter/HelloCenten...

Now that we have a MSI to play with, we can start the conversion process using the Desktop App Converter tool. We’ll need, again, to open the tool with administrative privileges.

This is the command we’re going to execute:
C:\>.\DesktopAppConverter.exe -Installer "C:\Installer\HelloCentennial.msi" -Destination "C:\Output\HelloCentennial" -PackageName "HelloCentennial" -Publisher "CN=<publisher_name>" -Version "1.0.0.0" -MakeAppx -Verbose -Sign

Here is the explanation of the different parameters required by the script:

  • -Installer is the path to the setup file we need to convert. In this case, it’s the HelloCentennial.msi file we’ve previously downloaded from GitHub.

  • -Destination is the folder where we want to store the output files created by the conversion process.

  • -PackageName is the name we want to give to the package.

  • -Publisher is the publisher’s name of the application. If you have some previous experience with UWP development, you’ll recall seeing this information in the manifest file of a UWP app. It’s univocally assigned by the Dev Center when you open a developer account. For the moment, for test purposes, you can just use the name you want, it’s just important that it starts with CN= and that it doesn’t contain spaces.

  • -Version is the version number of the app.

  • -MakeAppx means that, other than generating the folder which will contain all the files that needs to be packaged (like assets, the manifest, etc.), you want also to immediately generate the AppX package.

  • -Verbose is an optional parameter, which is useful because it will show you all the details of what’s going on during the conversion process.

  • -Sign is a parameter that allows to automatically generate the needed certificates to properly sign the AppX package. Without this digital signature, the package can’t be installed on a machine which doesn’t trust the generated certificate.


As already mentioned, I’ve created an installer using the MSI format, meaning that it automatically supports a silent installation process. The Desktop App Converter is able to automatically understand it and apply the required parameters to perform the installation in the proper way. However, many installers don’t work this way: they, at least, ask to the user to press a couple of Next buttons to move on with the process, to choose the folder where to install the app, sometimes to accept a license agreement, etc. In these cases, it’s likely that they still offer a silent installation mode, but they require to be launched with a special parameter (like Setup.exe /s ). If that’s your case, you can specify this information with an additional parameter provided by the Desktop App Converter called -InstallerArguments. In this case, for example, the previous command would look like this:
C:\>.\DesktopAppConverter.exe -Installer "C:\Installer\Setup.exe" -Destination "C:\Output\HelloCentennial" -PackageName "HelloCentennial" -Publisher "CN=<publisher_name>" -Version "1.0.0.0" -MakeAppx -Verbose -Sign -InstallerArguments "/s"

What happens during the conversion process? The tool will capture all the changes made by the setup during the installation (file copied, registry keys created, etc.) and will store them, so that they can be replicated in the sandbox when the app is executed into the container. This is the reason why apps distributed using AppX are more secure: all the reading operations will be performed against the real registry, but all the writing ones will be performed against a virtualized version. The isolated container will take care of merging the real registry with the virtualizing one, allowing your app to always work with a consistent and up-to-date version of the registry.

The consequence is that, when your app will be uninstalled, it will be like uninstalling a UWP app: there won’t be any leftover, neither in the file system or in the registry, which has always been one of the biggest causes of the Windows degrading performance issue over time.

At the end of the process, you will get a folder structure like the following one:



The real work done by the tool can be found inside the PackageFiles folder:



As you can see, this folder looks a bit like the one that Visual Studio creates when you start a new UWP project. You have an Assets folder, which contains the default images to be used for the tile, the Store or the icon in the Start menu. You have also a manifest file, the one called AppxManifest.xml : if you open it with a text editor, you will notice that it’s similar to the manifest file of a UWP app. However, compared to a native UWP app, you’ll find a couple of differences:

  • You’ll find the following capability, which allows the application to run in full trust. This option is available only for converted apps, a native UWP apps can’t have this kind of access.
    <Capabilities>
    <rescap:Capability Name="runFullTrust" />
    </Capabilities>

  • You’ll find an Application entry with all the info about the Win32 process that the UWP container will launch:
    <Application Id="HelloCentennial" Executable="HelloCentennial.exe" EntryPoint="Windows.FullTrustApplication">



Additionally, you’ll find other files and folders that captured the MSI setup process. For example, the Registry.dat file contains all the changes applied to the registry. Or, if you explore the VFS folder, you will find all the dependencies that are copied during the installation process (like the entry in the Start Menu).

Since, in the Desktop App Converter command, we’ve added the -MakeAppx parameter, the tool has already generated for us an AppX package starting from the PackageFiles folder, which we can deploy and share with other users or, eventually, publish on the Store when we’ll be granted access.

You can immediately see one of the new features of the Anniversary Update we’ve talked about in the previous post : in the past, to manually install an AppX package without using the Store, you needed to run a Powershell script. Now, instead, you have a simple visual installer: just double click on the file HelloCentennial.appx and you’ll be prompted with the following dialog:



However, if you press the Install button out of the box, you’ll stumble upon the following error:



The reason is that, by default, a UWP package needs to be signed with a valid certificate to be installed and this certificate needs to be trusted by the computer. When we publish a UWP app on the Store, this process is completely transparent: it’s the Store that takes care of signing the AppX package with a valid certificate during the submission process. In this case, instead, we’re trying to sideload a package without using the Store, so we need to take care of signing it.

If you remember, when we used the Desktop App Converter tool, we passed a parameter called - Sign , which already did the hard work for us. The package is already signed: the problem is that the certificate used for signing it, at the moment, isn’t trusted by our computer, which leads to an installation failure.

To solve this problem, you’ll need to add the certificate in the Trusted Root Certification Authority of the computer. You’ll find it in the folder generated by the tool (the one with the AppX package and the PackageFiles folder) and it’s called auto-generated.cer: simply double click on it, choose Install certificate and, when you’re prompted where to install it, choose Local machine and then the option Place all certificates in the following store . By pressing the Browse button, make sure to choose Trusted Root Certification Authorities and complete the process.



After you’ve completed this operation, you can now try again to install the AppX file. This time, after pressing the Install button, you will see a progress bar showing the installation status and, at the end, the window will become like the following one:



Now you have a Win32 app that has been embedded into a UWP app! If you look for it in the Start menu, you will see it like any other native UWP app: it will have a tile (even if a standard one generated by the tool), you’ll be able to pin it to the Start menu and, if you want to uninstall it, just right click on it and choose Uninstall.



However, if you’ll launch it, you will notice that it’s still a Win32 app and it will be able to create a text file on the user’s desktop just fine, without requiring any extra dialog or permission.

The installation process


The installation of a converted app is exactly the same of a native UWP application. The content of an AppX package is uncompressed into the folder C:\Program Files\WindowsApps which, by default, is hidden and it’s not accessible by any user (even an administrator one, since the owner of the folder is a system user). This is a read-only folder and it’s the consequence of one of the requirements that a converted app has to deal with: the application can only read data from this folder, but it can’t write any file. Data can be written only in the AppData folder, which is different for each user and it’s stored in the same folder where native UWP application handle the local storage. This is an example of the path a local folder for a converted app: C:\Users\<username>\AppData\Local\Packages\D5BA6BCD.OpenLiveWriter_7g8mfyn71hpbp

<username> is the name of your Windows user, while the name of the folder (in this sample, D5BA6BCD.OpenLiveWriter_7g8mfyn71hpbp ) corresponds to the Package Family Name of the application (in this case, I’ve taken as example is the converted version of Open Live Writer, the popular blogging tool which has been used to write this post).

The reason of this requirement is very simple: the AppData folder is stored inside the Windows space assigned to the user, so the app doesn’t require any administrative privilege to read and write files into this folder. The same scenario usually doesn’t apply, instead, to the folder where the app is installed. For example, one of the most popular locations where apps are installed, the C:\Program Files\ folder, is outside the user’s space, so it requires admin privileges to write to it. This is why you often get a UAC prompt during the setup process of a standard desktop app.

If you already have some previous experience with UWP development, this isn’t something new: they’re the same exact folders where a native UWP app stores the content of the AppX file (which usually matches with the content of the Visual Studio project) and its local data.

Inside this folder you will find a subfolder called AppData , which is where the local app data folder of your application will be mapped to. This means that, every time you use the following C# code to get access to the local app data folder:
System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

your application will get a reference to this folder.

A native Win32 application, instead, creates his own AppData folder in the path C:\Users\<username>\AppData\Local

However, for the application the AppData path will be completely transparent: no matter if it’s running as native or as converted, it will automatically access to the correct location.

Updating the converted app


If you have some previous UWP development experience, you probably already hinted that you have the opportunity to enhance your application without writing a single line of code: since now you have a manifest file, you can edit it with Visual Studio or a text editor and start adding features and capabilities like protocol support, file association, background tasks declaration, etc. You can also define new assets and replace the existing ones with real images, to give to your application a better look and feel, exactly like you would do with a regular UWP app.

Additionally, converted applications have access to a set of capabilities that aren’t normally available to a UWP app, like the ability to add context menu entries in File Explorer. You can find the list of all these capabilities on MSDN: https://msdn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extensions

A real world example of this scenario when you use the Desktop App Converter is related to assets: by default, the tool generates a set of sample icons (a square with an X in the middle) that, of course, will need to be replaced with the real ones from your application before sharing the app or publishing it to the Store. To achieve this goal, it’s enough to change the content of the Assets folder and replacing the existing images with the real ones. Additionally, if you want, you can also tailor your converted application to better support devices with high DPIs and high resolutions, by creating multiple version of the same image at different resolutions. Thanks to a simple naming convention, Windows will automatically pick the proper version based on the scale factor assigned to the device.

By default, you need to provide at least the image in three different resolutions:

  • 44x44

  • 50x50

  • 150x150


The easiest way to provide more versions of the assets is to leverage a Visual Studio extension called UWP Tile Generator ( https://marketplace.visualstudio.com/items?itemName=shenchauhan.UWPTileGenerator ). After you have installed it, simply create a new Universal Windows Platform app in Visual Studio (an empty project will be fine) and add, in the Assets folder, the icon of your application at the highest possible resolution. Then, right click on it and choose the option Generate UWP tiles.



Automatically, the extension will create, in the Assets folder of the empty UWP project, all the different versions of the image in all the supported resolutions and scaling factors. You will notice, in fact, that all the images will have the same base name (like Square44x44Logo.png ) but with a prefix before the file extension, that specifies the scale factors which the image refers to (like Square44x44Logo.scale-200.png ). This way, Windows 10 will automatically pick the proper version of the image, based on the resolution, DPI and viewing distance of the device where the app is running.

Now you can simply copy all the images contained in the Assets folder of the empty UWP project into the Assets folder of the converted app, replacing eventually the existing ones.

Repackaging the app


There’s an important caveat to remember: every time we change something in the PackageFiles folder created by the Desktop App Converter tool (like we just did, by replacing the assets), the AppX file that the tool has generated doesn’t automatically update itself, so we need to generate a new AppX package starting from the updated folder.

In fact, if we would try to uninstall and reinstall again the HelloCentennial.appx package after our changes, we’ll notice that the assets will continue to be the old ones.

Since, in this case, we didn’t change the actual code of the Win32 app, but we just changed the package content (the assets folder, in this case), we don’t have to go through the whole procedure of converting the MSI into an AppX using the Desktop App Converter tool, but we can just use a command line tool provided by the Windows 10 SDK, called makeappx.exe . Do you remember that, when we used the tool, we added a parameter called -MakeAppx ? Under the hood, the Desktop App Converter used this tool to create the package for us.

Using this tool is quite easy: first you have to open a Visual Studio Command Prompt (you can find it in the Start menu), which has already set all the proper paths to give you access to the tool no matter which folder you are. However, in case you want to use a standard command prompt, you’ll be able to locate the makeappx.exe file in the following folder: C:\Program Files (x86)\Windows Kits\10\bin\x64\

To recreate the AppX it’s enough to execute the following command:
makeappx pack -d "C:\Output\HelloCentennial\PackageFiles" -p "C:\Output\HelloCentennial\HelloCentennial.appx"

The required parameters are:

  • pack , which specifies that we want to create a package.

  • -d is the path of the PackageFiles folder that was previously created by the Desktop App Converter which contains our manifest, assets and all the packaged files.

  • -p is the path and name of the AppX file we want to create.


After executing this command, you’ll find an updated AppX file, that you can install to deploy the new version with protocol support on your computer. However, if you’ll try to launch it you’ll find another surprise:



If you remember what I’ve explained earlier in the article, every UWP package needs to be signed (unless you’re going to publish it on the Store): however, when we used the Desktop App Converter for the first time, we didn’t need to take care of this operation, since we used the -Sign parameter which did all the hard work for us.

Now, instead, since we have manually created the package, we need to sign it by ourselves, using another tool provided by the Windows 10 SDK, called signtool.exe . However, we can reuse the certificates that were automatically generated by the Desktop App Converter (do you remember the files called auto-generated.cer and auto-generated.pfx that have been placed in the output directory)?

As such, we can just use the following command in the same Visual Studio command prompt we’ve previously used:
signtool.exe sign /a /v /fd SHA256 /f "C:\Output\HelloCentennial\auto-generated.pfx" /p "123456" "C:\Output\HelloCentennial\HelloCentennial.appx"

The important parameters here are:

  • -f , which is the path of the .pfx file that is needed to sign the package.

  • -p , which is the password of the .pfx file. When you automatically create the certificate using the -Sign option of the Desktop App Converter, the generated .pfx file will have 123456 as default password. This parameter is optional: if you decide to create your own certificate, in fact, you can also decide to generate it without any password protection.

  • The last parameter is the path of the AppX package to sign (the one we’ve previously generated with the makeappx.exe tool).


That’s all! Now you should be able to properly install the updated package with the correct assets.

If you don’t want to rely on the certificates automatically generated by the tool, you can also create your own and use them to sign the package: the procedure is quite simple and it’s described in this article https://msdn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-signing . This is the best approach to use when you want to distribute the application, for example, in an enterprise environment and you want to create a certificate that will be shared among all the computers of the company.

Wrapping up


In this article we’ve seen how, starting from a MSI installer, we’ve been able to create an AppX package, keeping the best of both worlds: the flexibility of a Win32 app and the better security and distribution model of an AppX package. In the end, we’ve seen how, since what we get is simply a UWP package, we can start tweaking the app without writing actual code, by editing the manifest file or changing the default assets.

What if you have changed something not just in the package definition, but also in the Win32 application (like a new feature or a new piece of code)? In this case, you would have needed to go again through the whole conversion process:

  1. Generating a MSI installer starting from the Windows Forms executable

  2. Running the Desktop App Converter tool

  3. Tweak again the manifest file or the assets


However, this is a different scenario than the one we have previously started with: we aren’t talking anymore about an installer, but about an executable or an app for which we own the source code and that we want to update it and turn into an AppX.

In this scenario, Desktop App Converter isn’t our friend, but we need to use a different approach, which we’re going to see in the next article.

Remember that you can find all the samples described in this article and in the next ones in the following GitHub repository: https://github.com/qmatteoq/DesktopBridge

Happy coding!