我已通过VSTS扩展将“自定义摘要”部分添加到“构建摘要”部分 .
我在构建完成的VSTS构建摘要部分中遇到以下错误 .
“ABC的VSTS扩展无法加载 . 了解有关此扩展的更多信息,包括可用的支持选项 . ”
贡献:
"id": "abcfef-build-status-section",
"type": "ms.vss-build-web.build-results-section",
"description": "ABC Scan Summary",
"targets": [
".build-info-tab",
"ms.vss-build-web.build-results-summary-tab"
],
"properties": {
"name": "ABC Summary Section",
"uri": "buildstatus.html",
"order": 20,
"height": 500
}
范围:
"scopes": [
"vso.build",
"vso.build_execute"
]
Html页面(buildstatus.html):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<script src="scripts/VSS.SDK.js"></script>
</head>
<body>
<script type="text/javascript">VSS.init();</script>
<h1>Hello World</h1>
<script type="text/javascript">VSS.notifyLoadSucceeded();</script>
</body>
</html>
请帮忙解决这个问题 .
提前致谢 .
4 回答
这通常是由于启动扩展时无法加载VSS.SDK.js文件引起的,请检查以下内容:
html页面中的src路径"scripts/VSS.SDK.js"是正确的 .
src路径和文件包含在"vss-extension.json"文件的"files"部分中 .
我通过分析Chrome浏览器的控制台日志找到了这个问题 . 我的组织防火墙似乎阻止了API调用来检索资源 . :)
https://xxxxxxxx.gallery.vsassets.io/_apis/public/gallery/publisher/xxxxxxxxxxxxxxxxxxxxxxxx=/Extension/status.html无法加载资源:net :: ERR_CONNECTION_CLOSED
谢谢-
似乎由于各种原因可能会发生此错误 . 在我的情况下,我忘了将脚本文件夹包含在清单中的“文件”中:
希望有人会发现它有用 .
我们知道,有一个existing extension sample用于Build Results Enhancer,源代码可以在GitHub上找到:https://github.com/Microsoft/vsts-extension-samples/tree/master/build-results-enhancer
似乎贡献没有任何问题,您可以专注于您的Html页面,并尝试在您的HTML页面中添加
usePlatformScripts: true
以查看问题是否仍然存在: