【问题标题】:Office add-in manifest file passes 'npm run validate' but fails when side loading to Office WebOffice 加载项清单文件通过“npm run validate”但在侧加载到 Office Web 时失败
【发布时间】:2020-04-28 08:30:25
【问题描述】:

我正在任务功能区中创建一个命令按钮,为我们的 Office 用户添加一些功能。我开始使用yeoman generator,当我运行npm start 时,加载项在本地MS Excel 上运行良好。它验证成功运行npm run validate

但是当我尝试在 Excel 上在线加载 manifest.xml 以测试它(通过Office Add-ins > Upload My Add-in)时,我尝试上传清单并立即返回消息:

Your add-in manifest is not valid.

对于调试问题不是很有帮助的消息。这是我的第一个加载项,所以我不知道如何继续,任何帮助将不胜感激。插件 manifest.xml 如下:

<?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>bae311b6-a1be-4055-a0fc-c0371d95dc89</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>Test</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Add-in Commands Sample" />
  <Description DefaultValue="Sample that illustrates add-in commands basic control types and actions" />
  <IconUrl DefaultValue="https://i.imgur.com/oZFS95h.png" />
  <SupportUrl DefaultValue="https://www.sfchronicle.com/terms_of_use/" />

  <Hosts>
    <Host Name="Workbook"/>
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://commandsimple.azurewebsites.net/Taskpane.html" />
  </DefaultSettings>

  <Permissions>ReadWriteDocument</Permissions>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">   
    <Hosts>
      <Host xsi:type="Workbook">
        <DesktopFormFactor>
          
          <GetStarted>
            <Title resid="Contoso.GetStarted.Title"/>
            
            <Description resid="Contoso.GetStarted.Description"/>
            
            <LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
          </GetStarted>
          
          <FunctionFile resid="Contoso.FunctionFile.Url" />

          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <CustomTab id="Contoso.Tab1">
              <Group id="Contoso.Tab1.Group1">
                <Label resid="Contoso.Tab1.GroupLabel" />
                <Icon>
                  <bt:Image size="16" resid="Contoso.PublishButton.Icon" />
                  <bt:Image size="32" resid="Contoso.PublishButton.Icon" />
                  <bt:Image size="80" resid="Contoso.PublishButton.Icon" />
                </Icon>
                
                <Control xsi:type="Button" id="Contoso.FeedsButton">
                  <Label resid="Contoso.FeedsButton.Label" />
                  <Supertip>
                    <Title resid="Contoso.FeedsButton.Label" />
                    <Description resid="Contoso.FeedsButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Contoso.FeedsButton.Icon" />
                    <bt:Image size="32" resid="Contoso.FeedsButton.Icon" />
                    <bt:Image size="80" resid="Contoso.FeedsButton.Icon" />
                  </Icon>

                  <Action xsi:type="ExecuteFunction">
                    <FunctionName>exportJSON</FunctionName>
                  </Action>
                </Control>
              </Group>

              <Label resid="Contoso.Tab1.TabLabel" />
            </CustomTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="Contoso.PublishButton.Icon" DefaultValue="https://localhost:3000/assets/livepublish.png" />
        <bt:Image id="Contoso.FeedsButton.Icon" DefaultValue="https://localhost:3000/assets/livefeed.png" />
        <bt:Image id="Contoso.TestPubButton.Icon" DefaultValue="https://localhost:3000/assets/testpublish.png" />
        <bt:Image id="Contoso.TestFeedsButton.Icon" DefaultValue="https://localhost:3000/assets/testfeed.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Contoso.FunctionFile.Url" DefaultValue="https://localhost:3000/fnfile.html" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="Contoso.FeedsButton.Label" DefaultValue="Create Feed" />
        <bt:String id="Contoso.PublishButton.Label" DefaultValue="Publish Project" />
        <bt:String id="Contoso.TestFeedsButton.Label" DefaultValue="Create Test Feed" />
        <bt:String id="Contoso.TestPubButton.Label" DefaultValue="Publish Test Project" />
        <bt:String id="Contoso.Tab1.GroupLabel" DefaultValue="Publish Options" />
        <bt:String id="Contoso.Tab1.TabLabel" DefaultValue="Devhub Deploy" />
        <bt:String id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://www.sfchronicle.com/terms_of_use/" />
        <bt:String id="Contoso.GetStarted.Title" DefaultValue="Deploy add-in was succesfully loaded">
          <bt:Override Locale="ja-jp" Value="Deploy Title" />
        </bt:String>      
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="Contoso.FeedsButton.Tooltip" DefaultValue="Click to create a feed for a project" />
        <bt:String id="Contoso.PublishButton.Tooltip" DefaultValue="Click to publish a project" />
        <bt:String id="Contoso.TestFeedsButton.Tooltip" DefaultValue="Click to create a test feed for a project" />
        <bt:String id="Contoso.TestPubButton.Tooltip" DefaultValue="Click to publish a test project" />
        <bt:String id="Contoso.GetStarted.Description" DefaultValue="Click a publish option">
          <bt:Override Locale="ja-jp" Value="JA-JP Get Started Title" />
        </bt:String>  
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>

【问题讨论】:

  • 尝试上传清单并删除 VersionOverrides 部分。如果这不会产生错误,则放回 VersionOverrides 但仅包含所需的子元素。如果这没有出错,请尝试将可选的子元素一个一个放回,直到出现错误。

标签: office365 ms-office office-js office-addins


【解决方案1】:

消除了可选元素,发现&lt;GetStarted&gt; 元素是有问题的部分。我将其删除并能够将加载项导入 Office Web。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-22
    • 2020-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-24
    相关资源
    最近更新 更多