Skip to content

Tooling support for PowerApps language and .msapp files

License

Notifications You must be signed in to change notification settings

nickjgill/PowerApps-Language-Tooling

 
 

Repository files navigation

Power Apps Source File Pack and Unpack Utility

**This project is still in Experimental - format may change **

We welcome feedback on the project, file format, and capabilities.

This tool enables Canvas apps to be edited outside of Power Apps Studio and managed in a source control tool such as GitHub. The basic work flow is:

  1. Download an existing Canvas app as a .msapp file, using File > Save as > This computer in Power Apps Studio.
  2. Use this tool to extract the .msapp file into editable source files.
  3. Edit these files with any text editor.
  4. Check these files into any source control manager.
  5. Use this tool to recreate a .msapp file from the editable source files.
  6. Upload the .msapp file using File > Open > Browse in Power Apps Studio.

This is similar to the Solution Packager for Microsoft Dataverse.

Usage

Use the test console app to unpack/pack today. In the future, this functionality will be included with the Power Apps CLI.

You will need .NET Core SDK v3.1.x (x64) in order to build. Build the test console app by running: \build.cmd
This will create: \bin\Debug\PASopa\PASopa.exe

To unpack a .msapp file: pasopa -unpack FromApp.msapp ToSourceFolder To pack a .msapp file: pasopa -pack ToApp.msapp FromSourceFolder

The tool aggressively ensures that it can faithfully round trip the conversion from .msapp to source files. An unpack will immediately do a sanity test by performing a repack and compare.

Folder structure

Unpack and pack use this folder structure:

  • \src - the control and component files. This contains the sources.
    • *.pa.yaml - the formulas extracted from the control.json file. This is the place to edit your formulas.-
    • CanvasManifest.json - a manifest file. This contains what is normally in the header, properties, and publishInfo.
    • *.json - the raw control.json file.
    • \EditorState*.editorstate.json - cached information for Studio to use.
  • \DataSources - all data sources used by the app.
  • \Connections - connection instances saved with this app and used when reloading into studio.
  • \Assets - media files embedded in the app.
  • \pkgs - A downloaded copy of external references, such as templates, API Definition files, and component libaries. These are similar to nuget/npm references.
  • \other - all miscellaneous files needed to recreate the .msapp
    • entropy.json - volatile elements (like timestamps) are extracted to this file. This helps reduce noisy diffs in other files while ensuring that we can still round trip.
    • Holds other files from the msapp, such as what is in \references

File format

The .pa.yaml files use a subset of YAML. Most notably and similar to Excel, all expressions must begin with an = sign. More details are available here

Merging changes from Studio

When merging changes made in two different Studio sessions:

  • Ensure that all control names are unique. It is easy for them not to be, as inserting a button in two different sessions can easily result in two Button1 controls. We recommend naming controls soon after creating them to avoid this problem. The tool will not accept two controls with the same name.
  • For these files, merge them as you normally would:
    • \src*.pa.yaml
  • If there are conflicts or errors, you can delete these files:
    • \src\editorstate*.json - These files contain optional information in studio.
    • \other\entropy.json
  • For any conflict in these files, it’s ok to accept the latest version:
    • \checksum.json
  • If there are any merge conflicts under these paths, it is not safe to merge. Let us know if this happens often and we will work on restructuring the file format to avoid conflicts.
    • \Connections*
    • \DataSources*
    • \pkgs*
    • CanvasManifest.json

Contributing

We welcome feedback on the design, file format, and capabilities. Comments and issues are very welcome.

This project is still experimental and we routinely refactor the folder structure, file format, and implementation in big ways. As such, we aren't yet accepting code contributions until we are more stable.

Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

Before making a Pull Request, please file an Issue and solicit discussion.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Setting up a dev box

For a developer machine (Windows 10, WSL, Linux, macOS), install:

Building and running tests

After cloning this repo (https://github.com/microsoft/PowerApps-Language-Tooling), open a terminal/cmd/PS prompt with the dotnet executable on the path. Check with: dotnet --version

To build, run tests and produce nuget packages, run this command:

./build ci

To list all build targets, run: ./build --list-tree

To see other build help, run: ./build --help

About

Tooling support for PowerApps language and .msapp files

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%