Canvas source code tool integrated with Power Platform CLI
Back in January we introduced an open source tool for unpacking a Canvas app into source files, perfect for working with Visual Studio Code, GitHub, Azure DevOps, and any other text based tools. The response has been wonderful, lots of good issues reported and discussion on our GitHub repro, and just within the last two weeks there have been over 500 clones of the tool by over 200 unique cloners.
We are very pleased to announce that our tool is now available in a pre-built form. No longer will you need to compile it yourself! The Power Platform Command Line interface now includes Canvas pack and unpack ready to run. The update was released this morning and Kartik has a blog post with all the details.
To get started working with canvas source files, download and install the Power Platform CLI in one of two ways:
- Download and install the stand alone Power Platform CLI.
- Download and install the public preview of the Power Platform Extension for Visual Studio Code, which includes the Power Platform CLI for use within Visual Studio Code.
If you already have the Power Platform CLI installed, you can update it to version 1.7.2 that includes canvas support with:
pac install latest
The commands have changed a little from the open source offering to fit in with the CLI’s command structure. For example, to unpack chess.msapp and place the results in the directory chess_src:
pac canvas unpack --msapp chess.msapp --sources chess_src
The app’s formulas can now be viewed and modified within the *.fx.yaml files of the chess_src directory.
When you are ready to bring the app back into the canvas studio to run and publish:
pac canvas pack --msapp chess_mods.msapp --sources chess_src
It’s that simple. The Power Platform CLI documentation goes into much more detail and explains how to interpret, modify, and merge the source files.
And now, you can do all of it from within VS Code. In this animation:
- A canvas app is downloaded through the canvas studio as an .msapp file.
- The file is unpacked within VS Code, creating a directory of source files.
- One of the source files is edited, changing the singular “Person” into the plural “People” (after all, this tool is all about enabling collaboration).
- A new .msapp file is created by packing the source directory.
- The .msapp file is uploaded to canvas studio.
- And finally, we see the result of our edit.
The canvas pack and unpack functionality is still in preview. It is very stable and has not changed much since January, but there still may be some more file format changes yet to come. For now we recommend treating the source files unpacked as a companion to the .msapp files, to continue archiving the .msapp file as well if you are using version control, in case there is an issue with this preview release or a source format change occurs in the future.
The tool’s open source GitHub project is not going away. That will continue to be the home of the tool’s source and will always contain the most up to date sources. It is the place to report issues and discuss enhancements. We will snapshot and release new versions of the repo through the Power Platform Command Line from time to time.