首页 文章

无法指定为OfficeApp manifest.xml设置的要求

提问于
浏览
0

我有一个Office加载项/ TaskPane应用程序 .

当我尝试在manifest.xml中指定为此应用程序设置的要求时,我从 office-addin-validator 收到以下错误:

命名空间http://schemas.microsoft.com/office/appforoffice/1.1中的OfficeApp元素在命名空间http://schemas.microsoft.com/office/appforoffice/1.1中具有无效的子元素要求

The documentation非常清楚 Requirements 实际上是允许在这个位置 .

我能够在 VersionOverrides 标签内添加需求集,该部分如下所示:

<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
        <bt:Sets>
            <bt:Set Name="ExcelApi" MinVersion="1.1"/>
        </bt:Sets>
    </Requirements>
    <!--- ... -->
</VersionOverrides>

但是, office-addin-validator 无法正确识别不支持旧版本的Excel .

这样做的正确方法是什么?我不知道这是 office-addin-validator 工具中的错误还是过时的文档 .

EDIT

这是一个失败的清单:

<?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>999dfa02-364b-450c-a66b-b4baaae2e6f9</Id>
    <Version>1.0.0.0</Version>
    <ProviderName>[Provider name]</ProviderName>
    <DefaultLocale>en-US</DefaultLocale>
    <DisplayName DefaultValue="My Office Add-in" />
    <Description DefaultValue="[Workbook Add-in description]"/>
    <IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png" />
    <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/hi-res-icon.png"/>
    <SupportUrl DefaultValue="[Insert the URL of a page that provides support information for the app]"/>
    <AppDomains>
        <AppDomain>AppDomain1</AppDomain>
        <AppDomain>AppDomain2</AppDomain>
        <AppDomain>AppDomain3</AppDomain>
    </AppDomains>
    <Hosts>
        <Host Name="Workbook" />
    </Hosts>
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.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.DesktopFunctionFile.Url" />
                    <ExtensionPoint xsi:type="PrimaryCommandSurface">
                        <OfficeTab id="TabHome">
                            <Group id="Contoso.Group1">
                                <Label resid="Contoso.Group1Label" />
                                <Icon>
                                    <bt:Image size="16" resid="Contoso.tpicon_16x16" />
                                    <bt:Image size="32" resid="Contoso.tpicon_32x32" />
                                    <bt:Image size="80" resid="Contoso.tpicon_80x80" />
                                </Icon>
                                <Control xsi:type="Button" id="Contoso.TaskpaneButton">
                                    <Label resid="Contoso.TaskpaneButton.Label" />
                                    <Supertip>
                                        <Title resid="Contoso.TaskpaneButton.Label" />
                                        <Description resid="Contoso.TaskpaneButton.Tooltip" />
                                    </Supertip>
                                    <Icon>
                                        <bt:Image size="16" resid="Contoso.tpicon_16x16" />
                                        <bt:Image size="32" resid="Contoso.tpicon_32x32" />
                                        <bt:Image size="80" resid="Contoso.tpicon_80x80" />
                                    </Icon>
                                    <Action xsi:type="ShowTaskpane">
                                        <TaskpaneId>ButtonId1</TaskpaneId>
                                        <SourceLocation resid="Contoso.Taskpane.Url" />
                                    </Action>
                                </Control>
                            </Group>
                        </OfficeTab>
                    </ExtensionPoint>
                </DesktopFormFactor>
            </Host>
        </Hosts>
        <Resources>
            <bt:Images>
                <bt:Image id="Contoso.tpicon_16x16" DefaultValue="https://localhost:3000/assets/icon-16.png" />
                <bt:Image id="Contoso.tpicon_32x32" DefaultValue="https://localhost:3000/assets/icon-32.png" />
                <bt:Image id="Contoso.tpicon_80x80" DefaultValue="https://localhost:3000/assets/icon-80.png" />
            </bt:Images>
            <bt:Urls>
                <bt:Url id="Contoso.Taskpane.Url" DefaultValue="https://localhost:3000/index.html" />
                <bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
                <bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="https://localhost:3000/function-file/function-file.html" />
            </bt:Urls>
            <bt:ShortStrings>
                <bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
                <bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
                <bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
            </bt:ShortStrings>
            <bt:LongStrings>
                <bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
                <bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
            </bt:LongStrings>
        </Resources>
    </VersionOverrides>
    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="WordApi" MinVersion="1.3"/>
            <Set Name="DialogApi"/>
            <Set Name="ImageCoercion"/>
        </Sets>
    </Requirements>
</OfficeApp>

1 回答

  • 0

    元素的顺序包含在方案中 . 它失败了,因为你以错误的顺序添加 Requirements . 您需要将 Requirements 部分放在 DefaultSettings 部分之前:

    <Hosts>
        <Host Name="Workbook" />
    </Hosts>
    <Requirements>
        <Sets DefaultMinVersion="1.1">
            <Set Name="WordApi" MinVersion="1.3"/>
            <Set Name="DialogApi"/>
            <Set Name="ImageCoercion"/>
        </Sets>
    </Requirements>    
    <DefaultSettings>
        <SourceLocation DefaultValue="https://localhost:3000/index.html" />
    </DefaultSettings>
    

相关问题