windows桌面应用程序

With Windows 10’s Anniversary Update, Microsoft is making it possible for developers to convert traditional Windows desktop applications to Universal Windows Platform (UWP) applications. But anyone can do this with any app–not just developers.

借助Windows 10的周年更新 ,Microsoft使开发人员可以将传统的Windows桌面应用程序转换为通用Windows平台(UWP)应用程序。 但是任何人都可以使用任何应用程序执行此操作,而不仅仅是开发人员。

With Windows 10’s converter, just give it a .msi or .exe file and it’ll spit out a .appx package. You can then sideload this app on your own PC, or–if you’re the application’s developer–you can submit the resulting UWP app to the Windows Store. This feature will arrive for everyone with Windows 10’s Anniversary Update, bringing many “legacy” applications to the Windows Store.

使用Windows 10的转换器,只需为其提供.msi或.exe文件,它就会吐出.appx程序包。 然后,您可以在自己的PC上侧面加载此应用程序,或者-如果您是该应用程序的开发人员-您可以将生成的UWP应用程序提交到Windows应用商店。 Windows 10周年更新将为所有人提供此功能, 从而将许多“旧版”应用程序带到Windows应用商店 。

为什么要这样做 (Why You’d Want to Do This)

This feature is the end result of Microsoft’s Project Centennial, which is designed to bring those “legacy” Win32 and .NET Windows desktop applications to the Windows Store and the new Universal Windows Platform.

此功能是Microsoft Project Centennial的最终结果,该项目旨在将这些“旧版” Win32和.NET Windows桌面应用程序引入Windows应用商店和新的通用Windows平台。

You might wonder why anyone would want to convert a desktop application to a new UWP app. For one thing, only UWP apps are allowed in the Windows Store. This allows developers to get a lot more eyes on their apps, not to mention single-click installation, easy purchasing, and automatic updates.

您可能想知道为什么有人会想要将桌面应用程序转换为新的UWP应用程序。 一方面,Windows应用商店中仅允许使用UWP应用。 这使开发人员可以更加关注自己的应用程序,更不用说单击安装,轻松购买和自动更新了。

Microsoft’s new UWP application platform is sandboxed, but desktop apps you convert are not. These applications will have full access to your system, just like a traditional desktop application. As Microsoft’s documentation says: “As a UWP app, your app is able to do the things it could do as a classic desktop app. It interacts with a virtualized view of the registry and file system that’s indistinguishable from the actual registry and file system.”

Microsoft的新UWP应用程序平台已沙盒化,但您转换的桌面应用程序却没有。 这些应用程序将具有对系统的完全访问权限,就像传统的桌面应用程序一样。 正如Microsoft的文档所述 :“作为UWP应用,您的应用能够执行其作为经典桌面应用所能做的事情。 它与注册表和文件系统的虚拟化视图进行交互,这与实际的注册表和文件系统没有区别。”

局限性 (The Limitations)

There are some important limitations here. First, you can only do this on the Windows 10 Anniversary Update. For now, it’ll work with Windows 10 Insider Preview build 14316 and higher, so you’ll need to join the Windows Insider program and use an Insider Preview build of Windows 10.

这里有一些重要的限制。 首先,您只能在Windows 10周年更新中执行此操作。 目前,它可与Windows 10 Insider Preview内部版本14316和更高版本一起使用,因此您需要加入Windows Insider程序并使用Windows 10 Insider Preview内部版本 。

This feature also requires either the Professional or Enterprise editions of Windows 10. Windows 10 Home users won’t be able to use the Desktop App Converter. As of build 14316, it only worked on Windows 10 Enterprise, but support for Windows 10 Professional is coming. Currently, this tool can only be used on 64-bit versions of Windows, and the resulting AppX package can only be installed on 64-bit versions of Windows. This will change in future Insider builds of Windows 10.

此功能还需要Windows 10的专业版或企业版。Windows 10家庭用户将无法使用Desktop App Converter。 从内部版本14316开始,它仅适用于Windows 10 Enterprise,但即将支持Windows 10 Professional。 当前,此工具只能在Windows的64位版本上使用,并且生成的AppX软件包只能在Windows的64位版本上安装。 这将在Windows 10的将来Insider版本中改变。

The resulting applications are intended for Windows 10 PCs. They won’t work on Windows 10 Mobile smartphones, Xbox One, HoloLens, Surface Hub, and the other Windows 10 platforms that run UWP apps. However, if you’re a developer, Microsoft offers a path to getting your desktop application into a cross-platform UWP application: “If you choose to move all of your app’s functionality out of the full-trust partition of the app and into the app container partition, then your app will be able to run on any Windows 10 device.”

生成的应用程序适用于Windows 10 PC。 它们不适用于Windows 10移动智能手机,Xbox One,HoloLens,Surface Hub和其他运行UWP应用的Windows 10平台。 但是,如果您是开发人员,Microsoft提供了一种将桌面应用程序转换为跨平台UWP应用程序的途径:“如果您选择将应用程序的所有功能移出应用程序的完全信任分区,并移至应用程序的应用容器分区,那么您的应用将可以在任何Windows 10设备上运行。”

However, some types of application behavior aren’t supported. An application can’t require it be run as Administrator or use other types of low-level system access. Microsoft provides a list of behaviors that aren’t allowed.

但是,不支持某些类型的应用程序行为。 应用程序不能要求其以管理员身份运行或使用其他类型的低级系统访问权限。 Microsoft提供了不允许的行为列表。

如何设置桌面应用转换器 (How to Set Up the Desktop App Converter)

Assuming you’re using a new enough build of the Windows 10 Insider Preview, you can download and install the Desktop App Converter from Microsoft’s Developer site. Download both the DesktopAppConverter.zip and BaseImage-14316.wim files. Extract the downloaded DesktopAppConverter.zip file to a folder on your computer and place the BaseImage file in the same directory. (If there’s a new build of Windows 10 available, you should see a new BaseImage file. You’ll need to use the BaseImage file with the same version number as your installed build of Windows 10.)

假设您正在使用足够新的Windows 10 Insider Preview版本,则可以从Microsoft的Developer网站下载并安装Desktop App Converter 。 下载DesktopAppConverter.zip和BaseImage-14316.wim文件。 将下载的DesktopAppConverter.zip文件解压缩到计算机上的文件夹中,然后将BaseImage文件放置在同一目录中。 (如果有可用的Windows 10的新版本,则应该看到一个新的BaseImage文件。您需要使用与已安装的Windows 10的版本号相同的BaseImage文件。)

You’ll also need to download and install the Windows 10 SDK.

您还需要下载并安装Windows 10 SDK 。

Next, open a PowerShell window as Administrator. To do so, open the Start menu, search for “PowerShell,” right-click its shortcut, and select “Run as Administrator.”

接下来,以管理员身份打开PowerShell窗口。 为此,请打开“开始”菜单,搜索“ PowerShell”,右键单击其快捷方式,然后选择“以管理员身份运行”。

Change PowerShell’s execution policy by running the following command. Agree to the change by typing y afterwards.

通过运行以下命令来更改PowerShell的执行策略。 稍后输入y同意更改。

Set-ExecutionPolicy bypass

Run the command below, replacing C:\Users\NAME\Downloads\DesktopAppConvertor with the path to the directory on your computer:

运行以下命令,将C:\Users\NAME\Downloads\DesktopAppConvertor替换为计算机上目录的路径:

cd -Path C:\Users\NAME\Downloads\DesktopAppConvertor

Set up the Desktop App Converter by running the following command:

通过运行以下命令来设置Desktop App Converter:

.\DesktopAppConverter.ps1 -Setup -BaseImage .\BaseImage-14316.wim

If you’re asked to reboot while running any of these commands, reboot your computer and then run the command again.

如果在运行这些命令时要求重新启动计算机,请重新启动计算机,然后再次运行该命令。

如何转换桌面应用程序 (How to Convert a Desktop Application)

You can now run the DesktopAppConverter.ps1 script from an Administrator PowerShell window to convert a desktop application to a UWP application in a single command. You’ll need the application’s installer to do this. As an example, we’ll use VLC here.

现在,您可以从Administrator PowerShell窗口运行DesktopAppConverter.ps1脚本,以单个命令将桌面应用程序转换为UWP应用程序。 您将需要应用程序的安装程序来执行此操作。 例如,我们将在这里使用VLC。

To view the detailed list of options, you can run the following command at any time:

要查看选项的详细列表,您可以随时运行以下命令:

get-help .\DesktopAppConverter.ps1 -detailed

Here’s a command you can use and adjust for your application:

这是您可以为应用程序使用和调整的命令:

.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14316
–Installer C:\Installer\MyApp.exe -InstallerArguments "/S" -Destination C:\Output\MyApp
-PackageName "MyApp" -Publisher "CN=<publisher_name>" -Version 0.0.0.1 -MakeAppx -Verbose

You’ll need to adjust the command to add your own publisher name, version, package name, and point it at the installer file and destination directory you prefer. The -InstallerArguments "/S" option here passes the /S switch to the installer, which makes many application installers install silently without any user input. Applications must be installable without any user input or you can’t convert them.

您需要调整命令以添加自己的发布者名称,版本,程序包名称,并将其指向您喜欢的安装程序文件和目标目录。 这里的-InstallerArguments "/S"选项将/S开关传递给安装程序,这使许多应用程序安装程序在没有任何用户输入的情况下静默安装。 应用程序必须可在没有任何用户输入的情况下安装,否则您将无法转换它们。

The application’s installer should be in its own directory without any other files, as the files in the same directory as the installer will be copied into the resulting .appx package.

应用程序的安装程序应位于其自己的目录中,没有任何其他文件,因为与安装程序位于同一目录中的文件将被复制到生成的.appx包中。

For example, we’re using VLC here, so here’s the command we’d use:

例如,我们在这里使用VLC,因此这是我们要使用的命令:

.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14316
–Installer C:\Users\chris\Downloads\vlc\vlc-2.2.2-win32.exe -InstallerArguments "/S" -Destination C:\Output\VLC
-PackageName "VLC" -Publisher "CN=VideoLAN" -Version 0.2.2.2 -MakeAppx -Verbose

The tool will give you an .appx package, which is the UWP version of the app.

该工具将为您提供.appx包,这是应用程序的UWP版本。

如何在不签名的情况下安装应用 (How to Install the App Without Signing It)

You’re normally required sign apps with a valid signature before they can be installed. Microsoft recommends creating a self-signed certificate and signing the app with that on your computer. You can do that using the instructions below, if you like.

通常,要求您先使用有效签名对应用进行签名,然后才能进行安装。 Microsoft建议创建一个自签名证书,并使用您计算机上的证书对应用程序进行签名。 如果愿意,可以按照以下说明进行操作。

However, if you just want to install the app on your own computer, you can do this yourself faster, without messing with any signatures. Windows 10 allows you to install apps without signing them if you’re installing an “unpackaged” app from a directory.

但是,如果您只想在自己的计算机上安装该应用程序,则可以自己完成此操作,而不会弄乱任何签名。 如果从目录中安装“未打包”的应用程序,则Windows 10允许您安装应用程序而无需对其进行签名。

To do this, open a PowerShell window as Administrator and run the following command:

为此,请以管理员身份打开PowerShell窗口并运行以下命令:

Add-AppxPackage -Path C:\Path\to\AppxManifest.xml -Register

You’ll find the AppxManifest.xml file next to the Application.appx file in the output directory you specified.

您可以在指定的输出目录中的Application.appx文件旁边找到AppxManifest.xml文件。

You can now launch the application from your Start menu. It will be a “Windows app” instead of a “Desktop app,” but it will otherwise look and work like a normal desktop app.

现在,您可以从“开始”菜单启动应用程序。 它将是“ Windows应用程序”,而不是“桌面应用程序”,但在外观和工作方式上将与普通的桌面应用程序相似。

如何签名和安装应用程序 (How to Sign and Install the App)

You don’t need to follow these instructions if you’ve already installed the application. This is the harder way.

如果您已经安装了该应用程序,则无需遵循这些说明。 这是更困难的方法。

You can normally only install an .appx package if it has a valid signature. Microsoft recommends using the signtool.exe application included with the Windows 10 SDK to create a self-signed certificate, which will allow you to install and test the application on your own computer.

通常,只有具有有效签名的.appx软件包才能安装。 Microsoft建议使用Windows 10 SDK随附的signtool.exe应用程序来创建自签名证书,该证书将允许您在自己的计算机上安装和测试该应用程序。

Just open a Command Prompt window as Administrator and run the following commands to create a self-signed certificate and sign the .appx package with it:

只需以管理员身份打开“命令提示符”窗口,然后运行以下命令来创建自签名证书,并使用它对.appx包进行签名:

cd "C:\Program Files (x86)\Windows Kits\10\bin\x64"
MakeCert.exe -r -h 0 -n "CN=Publisher" -eku 1.3.6.1.5.5.7.3.3 -pe -sv my.pvk my.cer
pvk2pfx.exe -pvk my.pvk -spc my.cer -pfx my.pfx
signtool.exe sign -f my.pfx -fd SHA256 -v C:\Path\to\application.appx

Note that the publisher you specify–that’s the "CN=Publisher" –must match the publisher you specified earlier when creating the AppX file. So, continuing with our VLC example from above, we’d have to use "CN=VideoLAN" .

请注意,您指定的发布者(即"CN=Publisher"必须与创建AppX文件时先前指定的"CN=Publisher"者匹配。 因此,从上面继续我们的VLC示例,我们将不得不使用"CN=VideoLAN"

You’ll be asked to enter a password. You can just leave the password blank.

系统将要求您输入密码。 您可以将密码留空。

You can now install the .appx package in a PowerShell (Administrator) window with the Add-AppxPackage command:

现在,您可以使用Add-AppxPackage命令在PowerShell(管理员)窗口中安装.appx软件包:

Add-AppxPackage C:\Path\to\application.appx


This feature can be used by anyone, but only developers–and maybe some system administrators–will want to go this route. Luckily, the process is extremely easy for developers.

任何人都可以使用此功能,但只有开发人员(也许还有一些系统管理员)才愿意采用此功能。 幸运的是,该过程对于开发人员而言非常容易。

翻译自: https://www.howtogeek.com/250041/how-to-convert-a-windows-desktop-app-to-a-universal-windows-app/

windows桌面应用程序

windows桌面应用程序_如何将Windows桌面应用程序转换为通用Windows应用程序相关推荐

  1. vscode中运行2个程序_在64位系统中运行32位或16位程序

    由于CPU和系统架构的更新,现行主流的Windows系统已经是64位.然而许多人还恋恋不舍的一些老游戏或老程序已经没有了更新.在64位的系统上运行这些程序,往往会出现运行故障.如何才能解决这个烦心事? ...

  2. linux桌面xfce美化_使用Xfce Linux桌面环境的8个理由

    linux桌面xfce美化 由于多种原因(包括好奇心),几周前,我开始使用Xfce作为Linux桌面. 原因之一是后台守护程序吞噬了我非常强大的主工作站上的所有CPU和I / O带宽. 当然,某些不稳 ...

  3. java反编译微信小程序_教你如何一键反编译获取任何微信小程序源代码(图形化界面,傻瓜式操作)...

    一键获取微信小程序源代码 1 Tips:2 一键获取微信小程序源码, 使用了C#加nodejs制作 直接解压在D盘根目录下后就可以使用 将小程序文件放到 wxapkg目录下 3 这个目录下有一些dem ...

  4. ar 微信小程序_【看一看案例集】AR+微信小程序(1):认识篇

    去年,看一看科技"看看AR"."奇幻洛阳"等支持AR技术的小程序陆续上线.与此同时,不少商城也对"AR+小程序"产生浓厚的兴趣.但面对这么个 ...

  5. windows桌面待办事项_想在手机桌面上安装一个便利贴,下载什么便签软件好?

    当我们在生活中有件事情比较重要,但是又担心自己忘记去做的时候,很多人会在比较显眼的位置粘贴一张便利贴,这样我们看到便利贴的时候,就不会忘记去做上面写的事情了.但是还有一些场景我们随时携带便利贴并查看内 ...

  6. ar 微信小程序_微信AR玩法支持实现后,微信小程序会有想象空间吗?

    7月5日,微信小程序正式支持实现AR效果,并向品牌商户.AR引擎服务商开放接入.首个支持AR动态试妆的美妆品牌小程序"阿玛尼美妆官方精品商城"在7月5日同步更新上线. 界面记者体验 ...

  7. 在安装好python后文件显示还是应用程序_在djang中找不到已安装的应用程序

    设置设置.py文件以识别已安装的"blog"应用程序 我还是有这个错误 没有名为blog的模块Request Method: GET Request URL: http // 12 ...

  8. java中如何运行小程序_一起学java(一)——运行第一个小程序

    接下来的一段时间内会更新一起学java系列,喜欢的关注一下我吧.微信公众号:什么都不懂的大佬:初学,有错误的地方请大家多多指教. ---------------分割线-------------- 一. ...

  9. java选择题多选题系统小程序_单选题与多选题判断得分(自动考试小程序,入门级)...

    [单选题与多选题判断得分] [核心代码] using System; using System.Collections.Generic; using System.ComponentModel; us ...

最新文章

  1. pcb 理论阻值、 过孔_射频电路PCB设计的困境和改善措施
  2. console用法java_使用console对javaScirpt进行全面调试-全面分析console用法
  3. Oracle设置权限和还原数据库
  4. python asyncio回调函数_python回调函数用法实例分析
  5. java内联_JAVA中的内联函数
  6. omnigraffle 画曲线_Omnigraffle画线框图的新手操作指南
  7. 【转】在Windows中搭建iPhone开发环境
  8. OpenCV trackbar 避免使用全局变量
  9. 非printf形式的十六进制和二进制打印(雅虎面试题)
  10. 12.Kong入门与实战 基于Nginx和OpenResty的云原生微服务网关 --- 高级案例实战
  11. 【去除教育】去除打印教育戳记插件
  12. android软件游戏显示fps测试工具,别被跑分骗了!能看安卓游戏帧数的小工具
  13. 小程序加载本地图片报错500
  14. 计算机ROM指什么意思,ROM是什么 刷ROM是什么意思
  15. 做自己的安卓拍照应用,其实很简单
  16. 程序员是怎样的一群人
  17. 2.CUDA 编程手册中文版---编程模型
  18. 说话人识别模型finetune
  19. 【机器学习】监督学习,非监督学习,半监督学习三者的定义区别及举例分析
  20. 小白兔快开门,我是你爸爸。WEB安全基础入门—访问控制漏洞和权限提升

热门文章

  1. CSS + HTML 实现纸张类似稿纸效果
  2. 配置开发库文档的命名表
  3. 【Spring】Day19
  4. 《MATLAB在语音信号分析与合成中的应用》下载地址
  5. 前端react,vue导出word的几种方法(可以导出图片)
  6. vijos p1304 回文数
  7. 433MHz无线通信--模块RXB90
  8. VBA将ppt保存为html,把某页PPT保存成一个演示文稿的VBA代码
  9. Web前端复习-2、表格与框架
  10. 常用符号计算机输入法,最常用的输入法有哪些?四款经常被人使用输入法