首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >边缘扩展符号失败

边缘扩展符号失败
EN

Stack Overflow用户
提问于 2017-08-14 03:22:53
回答 1查看 393关注 0票数 2

我正在将现有的Chrome扩展移植到Microsoft。当我在边缘.中作为临时扩展加载它时,扩展可以工作

现在我要打包签了。该包已成功生成。但是,当我尝试使用对其进行签名时,它会失败,并出现以下错误:

代码语言:javascript
复制
Edge extension manifest.json
Error Found: The JSON schema validation test detected the following errors:
Validation failed: Data does not match any schemas from "anyOf"
Schema location: /allOf/1/dependencies/background/anyOf
Manifest location: 
Validation failed for extension manifest: Extension\manifest.json
Impact if not fixed: Microsoft Edge extensions that violate the Windows Store certification requirements can’t be submitted to the Windows Store.
How to fix: Extension’s manifest.json must include valid entries for all required and specified fields. Please resolve the entries and conflicts above.

用于打包扩展名的命令:

代码语言:javascript
复制
manifoldjs -l debug -p edgeextension -f edgeextension -m EdgeExtension\manifest.json
manifoldjs -l debug -p edgeextension package Test\edgeextension\manifest\

我的舱单档案:

代码语言:javascript
复制
{
    "author": "Test",
    "background": {
        "page": "Agent/Ext/bg-loader.html",
        "persistent": false
    },
    "content_scripts": [
        {
            "matches": [
                "<all_urls>"
            ],
            "js": [
                "Agent/Content/contentLoader.js"
            ],
            "run_at": "document_start",
            "all_frames": true
        }
    ],
    "content_security_policy" : "script-src 'self'; object-src 'self'",
    "default_locale" : "en",
    "description": "Test Web Applications Using Google Chrome",
    "name": "Test",
    "permissions": [
        "nativeMessaging",
        "webNavigation",
        "webRequest",
        "webRequestBlocking",
        "tabs",
        "cookies",
        "browsingData",
        "debugger",
        "<all_urls>",
        "notifications",
        "unlimited_storage"
    ],
    "version": "1.0.0.0",
    "-ms-preload": {
        "backgroundScript": "backgroundScriptsAPIBridge.js",
        "contentScript": "contentScriptsAPIBridge.js"
    },
    "minimum_edge_version" : "33.14281.1000.0"
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-15 09:33:15

这条线的Alexey的帮助下,我找到了如何签署边缘扩展的方法。

注意:请确保在PowerShell中执行以下步骤,而不是命令行。

1.创建自签名证书

代码语言:javascript
复制
New-SelfSignedCertificate -Type Custom -Subject "CN=Contoso Software, O=Contoso Corporation, C=US" -KeyUsage DigitalSignature -FriendlyName <Your Friendly Name> -CertStoreLocation "Cert:\LocalMachine\My"

您可以在Microsoft Developer站点获取应用程序标识中的主题。

友好的名称可以是任何字符串。

2.导出证书

检查拇指指纹:

代码语言:javascript
复制
Set-Location Cert:\LocalMachine\My
Get-ChildItem | Format-Table Subject, FriendlyName, Thumbprint

出于安全原因,您需要一个导出密码。

代码语言:javascript
复制
$pwd = ConvertTo-SecureString -String <Your Password> -Force -AsPlainText 
Export-PfxCertificate -cert "Cert:\LocalMachine\My\<Certificate Thumbprint>" -FilePath <FilePath>.pfx -Password $pwd

3.将证书安装到受信任的根证书颁发机构。

在“开始”菜单中键入“管理计算机证书”,导航到受信任的根证书颁发机构\证书。右键单击它,所有任务,导入跟随向导完成导入。

4.使用SignTool对应用程序签名( SignTool与Windows10SDK一起安装)。请确保它存在于系统路径中)

检查扩展的哈希算法:

在您的AppxBlockMap.xml文件中解压.appx,检查HashMethod

代码语言:javascript
复制
<BlockMap xmlns="http://schemas.microsoft.com/appx/2010/blockmap" HashMethod="http://www.w3.org/2001/04/xmlenc#sha256">

哈希算法是#之后的值,例如,#sha256意味着您正在使用SHA256作为哈希算法。

代码语言:javascript
复制
SignTool sign /fd <Hash Algorithm> /a /f <Path to Certificate>.pfx /p <Your Password> <File path>.appx

5.现在你可以双击安装你的应用程序了.

官方参考资料:

创建包签名证书

使用SignTool签署应用程序包

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45667005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档