多个扩展,单个包 [英] Multiple extensions, single package

查看:76
本文介绍了多个扩展,单个包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个SPFx解决方案(包),里面有两个扩展。我们希望在一个>多个站点上使用/可见,我们希望其他扩展仅在特定站点上使用/可见(而不是其他站点)。


我们已更新两个在elements.xml和clientsideinstance.xml中,只有我们的第一个扩展名在所有网站上使用/可见。


由于只有一个包,因此似乎只有一个功能。可以更新package-solution.json以允许两个功能,我们可以启用一个并禁用其他所有功能吗?如果是这样,还有其他文件需要复制/更新吗?




- 谢谢。恭敬地,Janette M. Ricker

解决方案


1。对于一个解决方案包中的两个扩展,请修改Config.json作为以下演示:


在SharePoint Framework解决方案中创建多组件包


SPFx Webpart和Extension可以存在于一个应用程序中吗?


2。对于仅适用于单个站点的一个扩展,通过修改package-solution.json中的作用域无法实现。


由于范围可以设置为web或Tenant,但是,此范围无法检查特定网站,请参阅GitHub中的类似问题:


我们如何更改SPFx扩展的功能范围?


解决方法是使用PnP PowerShell管理,删除其他网站的扩展程序,使其仅适用于单个网站:


使用PnP PowerShell添加和删除自定义操作


管理租户scoped-spfx扩展


谢谢


最好的问候


We have a single SPFx solution (package) that has two extensions in it. One we want to be used/visible on one>many sites and we want the other extension to be only used/visible on a specific site (and no others).

We have updated both the elements.xml and clientsideinstance.xml and yet only our first extension is used/visible on all sites.

Since there is a single package, there appears to be a single feature. Can the package-solution.json be updated to allow for two features and we could enable one and disable the other everything? If so, are there any other files that also need to be duplicated/updated?


- Thank you. Respectfully, Janette M. Ricker

解决方案

Hi,

1. For two extensions inside one solution package, please modify the Config.json as the demos below:

Creating multi-component bundles in SharePoint Framework solutions

Can SPFx Webpart and Extension exist in a single app?

2. For one extension only available for a single site, this is not possible to achieve by modify the scope in package-solution.json.

As the scope can be set to web or Tenant, but still, this scope not able to check for a specific site please see the similiar question in GitHub:

How do we change the feature scope for an SPFx extension?

A workaround is to manage, delete the extension for other sites using PnP PowerShell to make it only available for a single site:

Add and Remove Custom Action Using PnP PowerShell

manage tenant scoped-spfx extensions

Thanks

Best Regards


这篇关于多个扩展,单个包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆