无法加载 Office 加载项

Could not load office add-in

我已经为 Office 加载项创建了示例清单文件。但是 xml 架构中存在一些问题。如果我自己评论 VersionOverrides 的内容,加载项工作正常。

如果有人能说说这个问题。

注意:源位置和函数文件在我的工作区中可用。

附上清单代码。

谢谢 阿比吉特

<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
      <Id>cea85fda-84f6-4278-8d81-74126a2c3870</Id>
      <Version>1.0.0.0</Version>
      <ProviderName>Microsoft</ProviderName>
      <DefaultLocale>en-US</DefaultLocale>
      <DisplayName DefaultValue="demo Add" />
      <Description DefaultValue="demo hello"/>
      <Capabilities>
        <Capability Name="Workbook" />
      </Capabilities>
      <AppDomains>
    <AppDomain>http://localhost:8080</AppDomain>
    <AppDomain>AppDomain2</AppDomain>
    <AppDomain>AppDomain3</AppDomain>
  </AppDomains>
  <!--EndBasicSettings-->
  <!--BeginTaskpaneMode integration. Office 2013 and any client that doesn't understand commands will use this section.
    This section will also be used if there are no VersionOverrides -->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <Requirements>
    <Sets DefaultMinVersion="1.1">
      <Set Name="TableBindings" />
    </Sets>
  </Requirements>
      <DefaultSettings>
        <SourceLocation DefaultValue="http://localhost:8080/excelDemo/Home.html" />
      </DefaultSettings>
      <Permissions>ReadWriteDocument</Permissions>
      <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
         <Hosts>
            <Host xsi:type="Workbook">
                <DesktopFormFactor>
          <!--Function file is an html page that includes the javascript where functions for ExecuteAction will be called. 
            Think of the FunctionFile as the "code behind" ExecuteFunction -->
          <FunctionFile resid="residDesktopCommnadUrl" />
          <!--PrimaryCommandSurface==Main Office Ribbon-->
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <!--Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab -->
            <!-- Documentation includes all the IDs currently tested to work -->
            <CustomTab id="SmartViewAddIns">
              <!--Group. Ensure you provide a unique id. Recommendation for any IDs is to namespace using your companyname-->

              <Label resid="residLabel5" />
            </CustomTab>

          </ExtensionPoint>
        </DesktopFormFactor>
            </Host>
         </Hosts>
         <Resources>
             <bt:Images>
                <bt:Image id="icon_login_16" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
                <bt:Image id="icon_login_32" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
                <bt:Image id="icon_login_80" DefaultValue="https://gsmadatahub-dev.corp.apple.com/opf-mac/display/icons/login.png"></bt:Image>
             </bt:Images>
            <bt:Urls>
                <bt:Url id="Contoso.FunctionFile.Url" DefaultValue="http://localhost:8080/excelDemo/commands.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="Contoso.Tab1.GroupLabel" DefaultValue="Test Group" />
                <bt:String id="Contoso.FunctionButton.Label" DefaultValue="Execute Function" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="Contoso.FunctionButton.Tooltip" DefaultValue="Click to Show Taskpane1" />
            </bt:LongStrings>
         </Resources>
      </VersionOverrides>



</OfficeApp>

清单中的问题是您使用了以下行:

<Label resid="residLabel5" />

但是您没有为residLabel5 定义Resource。清单仅在您定义了您使用的所有资源时才有效。

将以下行添加到清单中的 bt:ShortStrings 即可解决问题。

<bt:String id="residLabel5" DefaultValue="Test" />

补充一下 Alex 的回答:在一般情况下,我建议您通过验证工具 运行 您的清单,或者使用 运行 时间记录来诊断清单问题。有关详细信息,请参阅 https://dev.office.com/docs/add-ins/testing/troubleshoot-manifest