UWP 的“Add-DevAppPackage"Powershell 脚本检查开发人员许可证.这是侧载的问题吗? [英] UWP's 'Add-DevAppPackage' Powershell script checks for a developer licence. This is an issue for Sideloading?

查看:44
本文介绍了UWP 的“Add-DevAppPackage"Powershell 脚本检查开发人员许可证.这是侧载的问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 LOB(业务线)UWP 项目,我们希望将该应用程序作为 .appxbundle 文件与 .cer 文件一起分发> 和一个 Powershell 脚本.这是当您通过选择 Project->Store->Create App Packages...

I'm developing a LOB (Line-of-Business) UWP project, we're hoping to distribute the app as a .appxbundle file, alongside a .cer and a Powershell script. This is what is generated in the package for you when you generate a bundle from Visual Studio by selecting Project->Store->Create App Packages...

我遇到的问题是 Powershell 脚本 Add-DevAppPackage.ps1 在其中检查了开发人员许可证.具体来说,它调用 powershell cmdlet Get-WindowsDeveloperLicense.如果这没有返回任何内容,它会设置一个最终调用 Show-WindowsDeveloperLicenseRegistration 的变量,该变量显示一个弹出窗口,强制用户将其 Windows 10 设备置于开发人员模式".如果用户不这样做,则脚本将失败,用户将无法安装应用.

The problem I have is that the Powershell script, Add-DevAppPackage.ps1, has a check for a developer licence in it. Specifically it calls the powershell cmdlet Get-WindowsDeveloperLicense. If this doesn't return anything it sets a variable which eventually calls Show-WindowsDeveloperLicenseRegistration which shows a popup forcing the user to put their Windows 10 device into 'Developer Mode'. If the user doesn't do this, then the Script fails and the user can't install the app.

如果我们取消对开发人员许可证的检查,脚本会按照我的预期运行并安装应用程序和证书,当 Windows 10 计算机设置为侧载应用程序"或开发人员模式"时不会出现问题'.现在,当用户设备处于不使用开发人员功能"模式时,就会出现问题.脚本崩溃.

If we remove this check for a Developer Licence, the script acts as I'd expect and Installs the App, alongside the certificate, with no issues when the Windows 10 machine is either set to 'Sideload Apps' or 'Developer Mode'. The problem now arises when the users device is in the mode of 'Don't use developer features'. The script crashes.

有没有办法确定当前设备是否处于至少"旁加载应用模式,如果不是,则显示一个对话框以提示用户启用它?

Is there a way of finding out if the current device is in 'At Least' Sideload apps mode, and if it isn't, show a dialog to prompt the user to enable it?

目前用户必须启用开发者模式才能旁加载应用程序,我希望他们不必这样做.我完全希望用户只需启用侧载应用程序"

Currently users have to enable Developer Mode to be able to sideload an app, which I'd prefer they didn't have to do. I'd fully expect users to only have to enable 'Sideload apps'

推荐答案

有没有办法确定当前设备是否处于至少"旁加载应用模式,如果不是,则显示一个对话框以提示用户启用它?

Is there a way of finding out if the current device is in 'At Least' Sideload apps mode, and if it isn't, show a dialog to prompt the user to enable it?

AFAIK,暂时无法检测是否启用了旁加载应用程序模式.而且我们无权显示一个对话框来提示用户启用旁加载应用.

AFAIK, there is no way to detect whether the Sideload apps mode is enabled for now. And we have no access to show a dialog to prompt the user to enable the sideload apps.

现在当用户设备处于不使用开发者功能"模式时会出现问题.脚本崩溃.

The problem now arises when the users device is in the mode of 'Don't use developer features'. The script crashes.

这是因为在 Sideload 应用程序模式下安装应用程序时,您需要使用其可信证书安装应用程序.所有 UWP 应用都必须使用证书签名.

This is because when install apps in Sideload apps mode, you need to install the app with its trusted certificate. All UWP apps must be signed with a certificate.

目前用户必须启用开发者模式才能旁加载应用程序,我希望他们不必这样做.我完全希望用户只需要启用侧载应用程序".

Currently users have to enable Developer Mode to be able to sideload an app, which I'd prefer they didn't have to do. I'd fully expect users to only have to enable 'Sideload apps'.

在创建项目的包之前,您可以打开清单文件和Packaging标签:

Before create the package of your project, you can open the manifest file and in the Packaging lable:

您可以在此处选择使用哪个证书对您的应用进行签名.如果你不想修改这个,没关系,因为当你打包你的应用程序时,会自动生成一个证书文件,并且你说你希望将应用程序作为 .appxbundle 文件分发,以及 .cer 和 Powershell脚本.在旁加载应用模式下,不需要 Powershell 脚本文件.您只需复制 .appxbundle 文件和 .cer 文件,然后

Here you can choose which certificate to use to sign your app. If you don't want to modify this, it's OK, cause when you packaging your app, a certificate file will automatically generated, and you said you are hoping to distribute the app as a .appxbundle file, alongside a .cer and a Powershell script. In Sideload apps mode, the Powershell script file is not needed. You can just copy the .appxbundle file and a .cer file, and

  1. 启用旁加载应用模式.

  1. Enable the Sideload apps mode.

点击 .cer 文件以信任此认证.

Click the .cer file to trust this certification.

点击 .appxbundle 文件以安装您的应用.

Click the .appxbundle file to install your app.

启用 Sideload 应用程序模式后,请不要使用 .ps1 文件安装应用程序.

When the Sideload apps mode is enabled, please don't use .ps1 file to install the app.

这篇关于UWP 的“Add-DevAppPackage"Powershell 脚本检查开发人员许可证.这是侧载的问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆