Scott Hanselman

Putting (my VB6) Windows Apps in the Windows 10 Store - Project Centennial

September 14, '16 Comments [35] Posted in VB | Win10
Sponsored By

Evernote in the Windows 10 Store with Project CentennialI noticed today that Evernote was in the Windows Store. I went to the store, installed Evernote, and it ran. No nextnextnextfinish-style install, it just worked and it worked nicely. It's a Win32 app and it appears to use NodeWebKit for part of it's UI. But it's a Windows app, just like VB6 apps and just like .NET apps and just like UWP (Universal Windows Platform) apps, so I found this to be pretty cool. Now that the Evernote app is a store app it can use Windows 10 specific features like Live Tiles and Notifications and it'll be always up to date.

The Windows Store is starting (slowly) to roll out and include existing desktop apps and games by building and packaging those apps using the Universal Windows Platform. This was called "Project Centennial" when they announced it at the BUILD conference. It lets you basically put any Windows App in the Windows Store, which is cool. Apps that live there are safe, won't mess up your machine, and are quickly installed and uninstalled.

Here's some of the details about what's happening with your app behind the scenes, from this article. This is one of the main benefits of the Windows Store. Apps from the Store can't mess up your system on a global scale.

[The app] runs in a special environment where any accesses that the app makes to the file system and to the Registry are redirected. The file named Registry.dat is used for Registry redirection. It's actually a Registry hive, so you can view it in the Windows Registry Editor (Regedit). When it comes to the file system, the only thing redirected is the AppData folder, and it is redirected to the same location that app data is stored for all UWP apps. This location is known as the local app data store, and you access it by using the ApplicationData.LocalFolderproperty. This way, your code is already ported to read and write app data in the correct place without you doing anything. And you can also write there directly. One benefit of file system redirection is a cleaner uninstall experience.

The "DesktopAppConverter" is now packaged in the Windows Store as well, even though it runs at the command prompt! If your Windows Desktop app has a "silent installer" then you can run this DesktopAppConvertor on your installer to make an APPX package that you can then theoretically upload to the Store.

NOTE: This "Centennial" technology is in Windows 10 AU, so if you haven't auto-updated yet, you can get AU now.

They are also working with install vendors like InstallShield and WiX to so their installation creation apps will create Windows Store apps with the Desktop Bridge automatically. This way your existing MSIs and stuff can turn into UWP packages and live in the store.

DesktopAppConverter

It looks like there are a few ways to make your existing Windows apps into Windows 10 Store-ready apps. You can use this DesktopAppConverter and run it in your existing  silent installer. Once you've made your app a Store App, you can "light up" your app with Live Tiles and Notifications and  other features with code. Check out the https://github.com/Microsoft/DesktopBridgeToUWP-Samples GitHub Repro with samples that show you how to add Tiles or Background tasks. You can use [Conditional("DesktopUWP")] compilation if you have both a Windows Store and Windows desktop version of your app with a traditional installer.

If your app is a simple Xcopy-deploy app that has no installer, it's even easier. To prove this I installed Visual Basic 6 on my Windows 10 machine. OH YES I DID.

NOTE: I am using VB6 as a fun but also very cool example. VB6 is long out of support but apps created with it still run great on Windows because they are win32 apps. For me, this means that if I had a VB6 app that I wanted to move into the Store and widen my audience, I could.

I made a quick little Project1.exe in VB6 that runs on its own.

Visual Basic 6 on Windows 10

I made an AppxManifest.xml with these contents following this HelloWorld sample.

<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
<Identity Name="HanselmanVB6"
ProcessorArchitecture="x64"
Publisher="CN=HanselmanVB6"
Version="1.0.0.0" />
<Properties>
<DisplayName>Scott Hanselman uses VB6</DisplayName>
<PublisherDisplayName>Reserved</PublisherDisplayName>
<Description>I wish there was a description entered</Description>
<Logo>Assets\Logo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.14316.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust"/>
</Capabilities>
<Applications>
<Application Id="HanselmanVB6" Executable="Project1.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
BackgroundColor="#464646"
DisplayName="Hey it's VB6"
Square150x150Logo="Assets\SampleAppx.150x150.png"
Square44x44Logo="Assets\SampleAppx.44x44.png"
Description="Hey it's VB6" />
</Application>
</Applications>
</Package>

In the folder is my Project1.exe long with an Assets folder with my logo and a few PNGs.

Now I can run the DesktopAppConverter if I have a quiet installer, but since I've just got a small xcopyable app, I'll run this to test on my local machine.

Add-AppxPackage -register .\AppxManifest.xml

And now my little VB6 app is installed locally and in my Start Menu.

VB6 as a Windows App

When I am ready to get my app ready for production and submission to the Store I'll follow the guidance and docs here and use Visual Studio, or just do the work manually at the command line with the MakeAppx and SignTool utilities.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makeappx" pack /d . /p Project1.appx

Later I'll buy a code signing cert, but for now I'll make a fake local one, trust it, and make a pfx cert.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\makecert" /n "CN=HanselmanVB6" /r /pe /h /0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e 12/31/2016 /sv MyLocalKey1.pvk MyLocalKey1.cer
"C:\Program Files (x86)\Windows Kits\10\bin\x86\pvk2pfx" -po -pvk MyLocalKey1.pvk -spc MyLocalKey1.cer -pfx MyLocalKey1.pfx
certutil -user -addstore Root MyLocalKey1.cer

Now I'll sign my Appx.

NOTE: Make sure the Identity in the AppxManifest matches the code signing cert's CN=Identity. That's the FULL string from the cert. Otherwise you'll see weird stuff in your Event Viewer in Microsoft|Windows\AppxPackagingOM|Microsoft-Windows-AppxPackaging/Operational like "error 0x8007000B: The app manifest publisher name (CN=HanselmanVB6, O=Hanselman, L=Portland, S=OR, C=USA) must match the subject name of the signing certificate exactly (CN=HanselmanVB6)."

I'll use a command line like this. Remember that Visual Studio can hide a lot of this, but since I'm doing it manually it's good to understand the details.

"C:\Program Files (x86)\Windows Kits\10\bin\x86\signtool.exe" sign /debug /fd SHA256 /a /f MyLocalKey1.pfx Project1.appx

The following certificates were considered:
Issued to: HanselmanVB6
Issued by: HanselmanVB6
Expires: Sat Dec 31 00:00:00 2016
SHA1 hash: 19F384D1D0BD33F107B2D7344C4CA40F2A557749

After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Private Key filter, 1 certs were left.
The following certificate was selected:
Issued to: HanselmanVB6
Issued by: HanselmanVB6
Expires: Sat Dec 31 00:00:00 2016
SHA1 hash: 19F384D1D0BD33F107B2D7344C4CA40F2A557749


The following additional certificates will be attached:
Done Adding Additional Store
Successfully signed: Project1.appx

Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0

Now I've got a (local developer) signed, packaged Appx that has a VB6 app inside it. If I double click I'll get the Appx installer, but what I really want to do is sign it with a real cert and put it in the Windows Store!

VB6 in the Windows Store

Here's the app running. Pretty amazing UX, I know.

VB6 app as a Windows Store App

It's early days, IMHO, but I'm looking forward to a time when I can go to the Windows Store and get my favorite apps like Windows Open Live Writer, Office, Slack, and more! Now's the time for you to start exploring these tools.

Related Links


Sponsor: Big thanks to Redgate for sponsoring the feed this week. Discover the world’s most trusted SQL Server comparison tool. Enjoy a free trial of SQL Compare, the industry standard for comparing and deploying SQL Server schemas.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Wednesday, 14 September 2016 19:24:40 UTC
This is really good and I hope many apps start showing in the Store. One I really really want to see there is Visual Studio!

Another thing I would really love is to be able to install apps from the Store from script. Today, when I reset any of my computers, the first thing I do is run a .bat file that installs Chocolatey and then installs most of the apps I use (Chrome, Firefox, Opera, Filezilla, KDiff, OpenLiveWriter, Paint.NET, etc....), but after that I still need to install Visual Studio, SQL Server Express, Office and the non stock Store apps I use (Nextgen Reader, Trackster, Netflix, Enpass, Sway...).

I do understand the implications of this kind of script, but one can dreamm
Wednesday, 14 September 2016 19:32:30 UTC
That's great, however one of the limitations of most desktop apps is the use of third party components (lots of ActiveX controls in VB6).
If you're installing in a "sandbox" it won't be possible to have the ActiveX registered, right?

Wednesday, 14 September 2016 19:45:21 UTC
Maybe some further innovation from Microsoft to get VB6 running in a webpage to help further Microsoft branding and, well, innovation.
Josh McFadden
Wednesday, 14 September 2016 19:48:22 UTC
Will,

If I understand correctly how it works, they will be registered, but only be available to the app that installed them. Centennial created a shadow hive of the Registry and System folders with all the changes made by the installer, so the app see it all as if it was installed, but other apps don't. That is the beauty of it: Uninstall should actually work now!

The only things not allowed are Services and Drivers, if I'm not mistaken.
Wednesday, 14 September 2016 21:14:48 UTC
It would be nice when we can convert Visual Studio Code to an UWP application.
no name
Wednesday, 14 September 2016 23:15:37 UTC
Scott, way to tear open the crusty VB6 wound that never healed for so many people. I'm sure your colleagues at MS will love you for this. :)
Sam
Thursday, 15 September 2016 04:10:05 UTC
There's no technical reason VS Code can't be in the Store.
Scott Hanselman
Thursday, 15 September 2016 05:08:34 UTC
Are these apps securely sandboxed? How are they restricted in what they can do or access? I'm a but confused about that because APPX are meant to be secure AFAIK, but millions of Win32 apps do all sorts of potentially dangerous and dodgy things with Windows once they are installed. Could malware be put into the app store for example?
Jack
Thursday, 15 September 2016 07:24:20 UTC
Curious to know how it deals with modal pop up windows, scaling fixed size windows etc. AFAIU, store apps are mostly responsive UI and page navigation type UX.
Hemant Sathe
Thursday, 15 September 2016 09:08:43 UTC
Does this mean we can ditch VS for VB6 to make apps? I don't think I've ever used a more productive suite than VB6 - it was like Rails for desktop!
Thursday, 15 September 2016 11:55:21 UTC
So there's now some ability to convert a win32 app of any flavour and get it into the windows store.

From what I read, the DesktopAppConverter enables that win32 app to run only on a Windows10 desktop device with that win32 code running in a special redirect sandbox.

Yeah it's sort of a halfway house to somewhere and I'm sure there's some point to wanting to buy into this idea although I fail to see it. Don't expect to be able to package win32 code to run on any Windows10 device yet. v2.0 feature?

Joe
Thursday, 15 September 2016 13:03:35 UTC
Let Microsoft control access to my applications through the store, no thank you.
Thursday, 15 September 2016 14:11:13 UTC
For those of us that depend on access to win32 features, this is a godsend. It beats the heck out of the limited to the subset of converted UWP native API available.(Although to be fair is a lot better than the windows 8.1 native API access) I definitely gotta fiddle with this the first chance I get. I hadn't seriously considered the Windows Store a viable distribution platform until now. Thanks!!!!
Thursday, 15 September 2016 15:49:37 UTC
@TonyEdgecombe

Except appx can be distributed outside the store. By default in Windows 10 now you can install any appx that's signed by a trusted CA. So let's tone back the FUD a bit?
Thursday, 15 September 2016 16:15:01 UTC
FYI Advanced Installer can also make UWP (AppX) packages. You know, smaller vendors could also use a little mention-love, not only the big kahunas...
Nick
Friday, 16 September 2016 10:46:59 UTC
@ajas: Why he's sending a wrong message? It is amazing to hear that VB6 apps can be finally put on Windows Store! Me and many other developers I believe are still using it to this day - with no problems or whatsoever. It's such a complete RAD IDE, for which I would even say that it came way before its time, because it's still used to this day!
MS
Friday, 16 September 2016 14:04:00 UTC
As soon as I noticed the problems with privacy (from a company that has a bad history in that regard) I decided to never use the Windows 10 Store. I also declined the MS cloud account during install.
Richard
Friday, 16 September 2016 14:59:29 UTC
Microsoft could soon heal the VB6 wound by updating or open sourcing the VB6 programming environment.
And they could update the VBA programming IDE in Office too.

But it is interesting to see that you can put VB6 apps into the Windows store.

Microsoft still support the VB6 runtime on Windows until at least 2025 VB6 support statement

VB6 Programming
Friday, 16 September 2016 15:34:48 UTC
This are very good news. Slowly the VB6 is comming back.
The VB6 is an old giant that just works. It's a simple tool that can quickly create applications without unnecessary fuss and not as today's tools, from .net across Java, to the php,that are unnecessarily complicated and slow.
Friday, 16 September 2016 15:34:48 UTC
It's nice to see that we can port our vb6 applications to windows 10 store app. However point of concern are the third party controls and disk write access and database access authority for our application. Has anyone tried porting such kind of vb6 application?
Atul Chawathe
Friday, 16 September 2016 16:27:31 UTC
@MasonMcGlothlin

What would be the point of wrapping an existing VB6 app only to side load it on Windows 10? The title of this post is "Putting (my VB6) Windows Apps in the Windows 10 Store". It's nothing to do with FUD and everything to do with loosing control over your business, as I said no thank you.
Friday, 16 September 2016 17:56:34 UTC
Nice ! VB6 rocks !!!!!!!!!
Ola
Sunday, 18 September 2016 00:56:31 UTC
If it looks like a @?, swims like a @?, and quacks like a @?, then it's a @?. var @? = 'walled garden'
Dave
Tuesday, 20 September 2016 04:20:38 UTC
It glad to see VB6 *possible* come back to modern world.
VB6 is still great and i won't forget.
Cheung
Thursday, 22 September 2016 17:31:53 UTC
It's about time. Nice to see VB6 back in action!

Maitreya Vyas
Thursday, 22 September 2016 17:38:05 UTC
Only if AU ran fine on my PC. :/
Maitreya Vyas
Friday, 23 September 2016 00:51:56 UTC
They should allow one to wrap Silverlight OOB (Out of Browser) applications too. Would be great if you could push towards that direction. Judging from reply at Build presentation on desktop bridge, they don't even know what a Silverlight OOB app is.

In fact the Windows Store could allow one to upload a Desktop Silverlight app's .XAP with a manifest that states OOB installation is allowed (had such option) and it could run the bridge on the server-side and publish your app. The alternative for those who have big Silverlight OOB apps (see mine at http://studio.clipflair.net - http://clipflair.codeplex.com for example) is to port to WPF first, but that needs quite some work (less than porting to UWP), since stuff like PivotViewer and DeepZoom controls are missing from WPF (there is third-party DeepZoom implementation but not any PivotViewer one), apart from some other XAML differences with Silverlight which can be tricky to spot/resolve.
Monday, 26 September 2016 23:14:43 UTC
Wow, this is awesome,
But who wants a VB6 App in windows store?
Most VB6 Devs are either retired or a manager now!
Friday, 30 September 2016 12:53:08 UTC
This is a fab article - it would be great to be able to install apps via script. I wonder, are these apps securely sandboxed and are they restricted in what they can do or access?
Saturday, 01 October 2016 23:52:25 UTC
Scott, please can you make a post teaching how to make an appx package of a VB6 application (or any win32 app)? Not a msil converted one.

I think that the Microsoft did not explain very well how to do this.
Tuesday, 04 October 2016 14:46:49 UTC
Thanks for the tutorial!

But i followed all your steps but i receive this error when trying to install APPX:
Either you need a new certificate installed for this app package, or you need a new app package with trusted certificates. Your system administrator or the app developer can help. A certificate chain processed, but terminated in a root certificate which isn't trusted (0x800B0109)

another question:
Can i publish my software in windows store without buying any certificate? (Too Expensive for me, the cheapest is 170$~)

Thanks, please anyone answer me!!!
Saturday, 08 October 2016 05:00:36 UTC
Hi Scott, I built a AppX package using your method 2 - the manual way, but when I try to upload to the store, I get this error:

"Your developer account doesn’t have permission to submit apps converted with the Desktop App Converter at this time"

Is there a way to apply for the ability to submit Desktop App to the store?
Bill Shu
Saturday, 08 October 2016 05:12:14 UTC
Please ignore my comment, I saw the link at the bottom of your article. Sorry I didn't finish reading it all.
Bill Shu
Thursday, 13 October 2016 20:38:59 UTC
Working since 1991 with vb, making touch enabled dental software since 2002 using vb6 . Did you try to install vb6 on an updated win10 machine? I did today, but the setup.exe file let me alone. How to preserve our work on a new machine. Vb6 deserves a bright future. Jan Ulehake
Friday, 14 October 2016 05:19:59 UTC
This is great haha!
Does it support 16 Bit VB apps? =)
Joe
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.