调试 Outlook 加载项桌面
Debugging Outlook Add-in Desktop
我目前正在使用 yeoman 和 generator-office for Outlook 开发一个加载项,以将电子邮件及其附件保存到另一个服务。
Outlook 版本:MS Office Professional Plus 2016 v.16.0.48.49.1000
我可以通过转到文件->管理加载项->(打开 Outlook webapp 扩展页面)->从文件添加->Select 我的 manifest.xml.
然后我 运行 npm run start
我得到:
App type: desktop
Enabled debugging for add-in 17717569-bd61-4c6a-b99d-ca55924a2916. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
The dev server is running on port 3000. Process id: 9660
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload is not supported.
加载项是旁加载的,我可以使用它,但无法附加调试器,我被阻止了。
任何已知的解决方案?
编辑:我遵循了 https://docs.microsoft.com/en-us/outlook/add-ins/quick-start 的指南。
@MS Team 如果无法使用 Yeoman 添加调试器,是否可以使用 Visual Studio 方法?
您可以 运行 开发服务器 (npm run dev-server
) 而不是使用 npm start
,因为 Outlook 不支持旁加载。开发服务器 运行ning 后,您可以使用您提到的步骤加载加载项。在 Outlook 中 运行 加载项后,您可以使用浏览器开发工具对其进行调试。
如果您使用的是 Windows 10 版本 1903 或更高版本,它应该使用 Edge WebView,您可以使用 Windows 10 商店中的 Edge DevTools Preview 对其进行调试。 Windows 之前的版本,使用 Internet Explorer WebView,使用 F12
开发工具进行调试。
对于 Visual Studio 代码和 Windows 10 版本 1903 或更高版本,可以选择使用 Microsoft Office Add-in 调试器扩展 进行调试。
要安装它:
- 在 VSC -> 扩展 -> 搜索 Microsoft Office Add-in 调试器扩展并安装它
- 在
.vscode/launch.json
中,将以下代码添加到配置部分:
{
"type": "office-addin",
"request": "attach",
"name": "Attach to Office Add-ins",
"port": 9222,
"trace": "verbose",
"url": "https://localhost:3000/taskpane.html?_host_Info=HOST$Win32.01$en-US$$$[=10=]",
"webRoot": "${workspaceFolder}",
"timeout": 45000
}
- 在您刚刚复制的 JSON 部分中,找到“url”部分。在此 URL 中,您需要将大写的 HOST 文本替换为托管您的 Office add-in 的应用程序。例如,如果您的 Office add-in 用于 Excel,您的 URL 值将是“https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0".
来源:
https://docs.microsoft.com/en-us/office/dev/add-ins/testing/debug-with-vs-extension
我目前正在使用 yeoman 和 generator-office for Outlook 开发一个加载项,以将电子邮件及其附件保存到另一个服务。
Outlook 版本:MS Office Professional Plus 2016 v.16.0.48.49.1000
我可以通过转到文件->管理加载项->(打开 Outlook webapp 扩展页面)->从文件添加->Select 我的 manifest.xml.
然后我 运行 npm run start
我得到:
App type: desktop
Enabled debugging for add-in 17717569-bd61-4c6a-b99d-ca55924a2916. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
The dev server is running on port 3000. Process id: 9660
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload is not supported.
加载项是旁加载的,我可以使用它,但无法附加调试器,我被阻止了。
任何已知的解决方案?
编辑:我遵循了 https://docs.microsoft.com/en-us/outlook/add-ins/quick-start 的指南。
@MS Team 如果无法使用 Yeoman 添加调试器,是否可以使用 Visual Studio 方法?
您可以 运行 开发服务器 (npm run dev-server
) 而不是使用 npm start
,因为 Outlook 不支持旁加载。开发服务器 运行ning 后,您可以使用您提到的步骤加载加载项。在 Outlook 中 运行 加载项后,您可以使用浏览器开发工具对其进行调试。
如果您使用的是 Windows 10 版本 1903 或更高版本,它应该使用 Edge WebView,您可以使用 Windows 10 商店中的 Edge DevTools Preview 对其进行调试。 Windows 之前的版本,使用 Internet Explorer WebView,使用 F12
开发工具进行调试。
对于 Visual Studio 代码和 Windows 10 版本 1903 或更高版本,可以选择使用 Microsoft Office Add-in 调试器扩展 进行调试。
要安装它:
- 在 VSC -> 扩展 -> 搜索 Microsoft Office Add-in 调试器扩展并安装它
- 在
.vscode/launch.json
中,将以下代码添加到配置部分:
{
"type": "office-addin",
"request": "attach",
"name": "Attach to Office Add-ins",
"port": 9222,
"trace": "verbose",
"url": "https://localhost:3000/taskpane.html?_host_Info=HOST$Win32.01$en-US$$$[=10=]",
"webRoot": "${workspaceFolder}",
"timeout": 45000
}
- 在您刚刚复制的 JSON 部分中,找到“url”部分。在此 URL 中,您需要将大写的 HOST 文本替换为托管您的 Office add-in 的应用程序。例如,如果您的 Office add-in 用于 Excel,您的 URL 值将是“https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0".
来源: https://docs.microsoft.com/en-us/office/dev/add-ins/testing/debug-with-vs-extension