将(我的VB6)Windows应用程序放入Windows 10商店-Centennial项目

I 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.

今天我注意到Evernote在Windows Store中。 我去了商店,安装了Evernote ,然后它运行了。 没有nextnextnextfinish样式的安装,它可以正常工作,并且运行良好。 这是一个Win32应用程序,它似乎在其部分UI中使用NodeWebKit。 但这是一个Windows应用程序,就像VB6应用程序,.NET应用程序和UWP(通用Windows平台)应用程序一样,因此我发现它非常酷。 现在,Evernote应用程序是商店应用程序,它可以使用Windows 10特定功能,例如“实时平铺”和“通知”,并且它将始终保持最新状态。

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.

通过使用通用Windows平台构建和打包Windows应用商店,Windows应用商店开始(缓慢地)推出并包括现有的桌面应用和游戏。 当他们在BUILD会议上宣布该计划时,它被称为“百年纪念计划”。 它使您基本上可以将任何Windows应用程序放入Windows应用商店,这很酷。 在那里生活的应用程序很安全,不会破坏您的计算机,并且可以快速安装和卸载。

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.

下面是一些关于什么是与幕后的应用中发生的,从细节这篇文章。 这是Windows应用商店的主要优势之一。 商店中的应用程序无法在全球范围内破坏您的系统。

[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.

[app]在特殊的环境中运行,在该环境中,app对文件系统和注册表的所有访问都将重定向。 名为Registry.dat的文件用于注册表重定向。 它实际上是一个注册表配置单元,因此您可以在Windows注册表编辑器(Regedit)中查看它。 当涉及到文件系统时,唯一重定向的是AppData文件夹,它被重定向到与所有UWP应用程序存储应用程序数据相同的位置。 此位置称为本地应用程序数据存储,您可以使用ApplicationData.LocalFolder属性访问它 这样,您的代码已经被移植到正确位置读写应用程序数据,而无需您进行任何操作。 您也可以直接在此处写。 文件系统重定向的一个好处是更干净的卸载体验。

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.

现在,即使它在命令提示符下运行,“ DesktopAppConverter ”也将打包在Windows应用商店中! 如果Windows桌面应用程序具有“静默安装程序”,则可以在安装程序上运行此DesktopAppConvertor,以制作一个APPX软件包,然后从理论上将其上传到商店。

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

注意:此“百年纪念”技术位于Windows 10 AU中,因此,如果尚未自动更新,则可以立即获取AU

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.

他们还与InstallShield和WiX等安装供应商合作,以便他们的安装创建应用程序将使用Desktop Bridge自动创建Windows应用商店应用程序。 这样,您现有的MSI和资料可以变成UWP软件包并存在于商店中。

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.

看起来有几种方法可以将现有Windows应用程序变成Windows 10 Store-ready应用程序。 您可以使用此DesktopAppConverter并在现有的静默安装程序中运行它。 将您的应用程序变为商店应用程序后,您可以使用“实时平铺”和“通知”以及其他带有代码的功能来“点亮”您的应用程序。 查看https://github.com/Microsoft/DesktopBridgeToUWP-Samples GitHub Repro,其中包含向您展示如何添加Tiles或Background任务的示例。 如果同时具有传统安装程序的应用程序的Windows应用商店版本和Windows桌面版本,则可以使用[Conditional(“ DesktopUWP”)]编译。

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.

如果您的应用程序是没有安装程序的简单Xcopy部署应用程序,那么它会更加容易。 为了证明这一点,我在Windows 10计算机上安装了Visual Basic 6。 哦,是的。

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.

注意:我使用VB6作为一个有趣但也很酷的示例。 VB6长期以来不受支持,但是使用它创建的应用程序在Windows上仍然运行良好,因为它们是Win32应用程序。 对我来说,这意味着,如果我有一个VB6应用程序,我想进入商店并扩大受众范围,就可以。

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

我在VB6中制作了一个快速运行的小Project1.exe。

Visual Basic 6 on Windows 10

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

此HelloWorld示例之后,我使用这些内容制作了一个AppxManifest.xml。

<?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.

在该文件夹中是我的Project1.exe,其中包含一个带有我的徽标和几个PNG的Assets文件夹。

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.

现在,如果我有一个安静的安装程序,我可以运行DesktopAppConverter ,但是由于我只有一个小型xcopyable应用程序,因此我将在本地计算机上运行它以进行测试。

Add-AppxPackage -register .\AppxManifest.xml

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

现在,我的小VB6应用已安装在本地和“开始”菜单中。

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.

当我准备好将我的应用准备好投入生产并提交给商店时,我将按照此处的指南和文档使用Visual Studio,或者仅使用MakeAppxSignTool实用工具在命令行中手动进行工作。

"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.

稍后,我将购买一个代码签名证书,但是现在,我将制作一个假的本地证书,信任它,并制作一个pfx证书。

"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.

现在,我将签署我的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)."

注意:确保AppxManifest中的身份与代码签名证书的CN = Identity相匹配。 这是证书中的FULL字符串。 否则,您将在Microsoft | Windows \ AppxPackagingOM | Microsoft-Windows-AppxPackaging / Operational中的事件查看器中看到奇怪的内容,例如“错误0x8007000B:应用清单发布者名称(CN = HanselmanVB6,O = Hanselman,L = Portland,S =或者,C = USA)必须与签名证书的主题名称完全匹配(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.

我将使用这样的命令行。 请记住,Visual Studio可以隐藏很多内容,但是由于我是手动进行的,因此最好了解细节。

"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!

现在,我有一个(本地开发人员)签名,打包的Appx,其中包含VB6应用程序。 如果我双击我将得到Appx安装程序,但是我真正想做的是用真实的证书对其进行签名,然后将其放入Windows应用商店中!

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.

恕我直言,这是早期的日子,但是我很期待能够进入Windows应用商店并获得我喜欢的 Windows Open Live Writer ,Office,Slack等应用程序! 现在是时候开始探索这些工具了。

相关链接 (Related Links)

翻译自: https://www.hanselman.com/blog/putting-my-vb6-windows-apps-in-the-windows-10-store-project-centennial

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值