MoreBeerMorePower

Power Platform中心だけど、ノーコード/ローコード系を書いてます。

Two types of Canvas App

f:id:mofumofu_dance:20210709153620p:plain

Background

In a recent update of canvas studio (> v3.21063) , it was found that the feature to import/export canvas app components will be retired in the future.

f:id:mofumofu_dance:20210709143755p:plain

With this retirement, app makers will need to use the Component library to share components within the organization, and need to consider how to migrate from "standalone" app that contain components into component library.

Or, although the externally published component samples (PnP repo or Community samples), most of them are standalone apps, it is preferable to add them to the component library when utilizing them.

In this post, I will share some of the interesting properties I discovered in the course of these studies.

Component library is another type of App

A component library looks no different from a regular/standalone app at the time of creation, except for the lack of form factor options.

However, once it is added as a library, the app will not appear in the list of executable apps, and the components shown in "Get more components" will only be those created in the Component library.

f:id:mofumofu_dance:20210709145919p:plain

What is difference of standalone app and component library?

If you convert your app to source code, you will find that there is only one place where the library differs from a regular app.

That is the "DocumentType" property in CanvasManifest.

For regular app, value for "DocumentType" is "App", on the other side, for component library, it is "ComponentLibrary".

f:id:mofumofu_dance:20210709150454p:plain

Aside from the screen details and checksum, this is the only difference, and it turns out that the difference in behavior described above is determined by the value of this property.

Convert app type

Since there is only one difference, let's convert the PnP shared app (standalone) into a Component library by rewriting this.

Download the source code, rewrite the "DocumentType" in CanvasManifest.json, and pack it again into msapp.

All you have to do is open msapp in studio and save it.

f:id:mofumofu_dance:20210709151804p:plain

*Here, the form factor can be either tablet or phone.

Okay, you can migrate components in standalone app into component library!