Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 9Ezcd6UxjZQ80TOezmIJRC
Power Apps - Building Power Apps
Answered

Power App Solution Package - Extract and Re-ZIP Programmatically

Like (1) ShareShare
ReportReport
Posted on 13 Sep 2020 03:49:09 by 317

Hello dear community members. I really need your help figuring out Power Apps / Power Automate Solution Packages work. I can't figure how to to generate a proper ZIP solution that is understood by the Power Platform during the import process.

 

What I am trying to do

  1. Manually. Export a solution that contains Power Apps, Power Automate as a ZIP file. 
  2. Unzip the ZIP file programmaticaly.
  3. Perform a minor change in several unzipped files. 
  4. ZIP up the files back to a solution programmatically, using PowerShell,
  5. Import Solution (zip) file to a new/same environment.

3_Import package.png

 

I have an issue with the Step #4 - Zipping the solution files back to a solution file. To be more specific, the issue is in the step #5. When I generate a ZIP file programmatically, Step #5 fails. When I create a ZIP file manually (see screenshot below) - Step #5 succeeds.

 

Experiment A) If we manually create a solution file, then Step #5 works as expected: I can import a solution file with no issues:

1_Manual Zipping.png

Manually Zip solution file is imported perfectly fine:
DenisMolodtsov_0-1599966170892.png

Experiment B) However, I am trying to automate the entire process and do not want to manually ZIP anything. So, I am ZIPping the solution files using PowerShell:

 

2_PowerShell zipping.jpg

As a result of running this PowerShell script, I get a ZIP solution file. It looks completely valid and I don't see any issues with it.

So, now, I am trying to import this solution file via https://make.powerapps.com/, but this time I get an error:

 

Solution "ContosoSolution" failed to import: Error while importing workflow {ed432f3c-6ee6-ea11-a817-000d3af41a7c} type ModernFlow name PowerApp -> Get items: Workflow import: Xaml file is missing from import zip file: FileName: /Workflows/PowerApp-Getitems-ED432F3C-6EE6-EA11-A817-000D3AF41A7C.json

 

This is what the solution import log contains:

5_Error Log.png


According to the error, the solution ZIP file is missing a /Workflows/....json file. This error seems to be misleading, because the ZIP file does contain this file:

 

10_Workflows.png



Question how can I generate a solution file programmatically in a way that can be properly read by the Power Platform during the import process? Why generating ZIP files manually works while programmatic generation causes an issue?


How to quickly replicate an issue

- Export solution package

- Unzip it

- ZIP it back using PowerShell:

 

[System.IO.Compression.ZipFile]::CreateFromDirectory($SourceDirectory, "PowerShell-Optinal-UTF8.zip",
[System.IO.Compression.CompressionLevel]::Fastest, $false, [System.Text.Encoding]::UTF8 )

 

- Import the ZIP Solution file

- Result: Get an error

More details

  • Why I am asking this question? I am trying to upgrade the Power Apps / Flow migrator script to also support Solution migration. 
  • I was trying to ZIP the file:
    • With UTF8 encoding
    • With different compressions:
      • Uncompressed
      • Fastest
      • Optimal
    • Was trying to Compress-Archive PowerShell cmdlet and [System.IO.Compression.ZipFile]::CreateFromDirectory .NET function. 

 

7_Compare.png

 

8_Compare ZIPS.png

Categories:
  • Praba Profile Picture
    39 on 21 Apr 2023 at 18:54:31
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Hi Denis facing the same issue your code is working fine but I need to tweek the logic little bit can i specify the source and destination tar -a -c -f "Sample.zip" * in this code as of now I can able to specify the destination of the gzip to create but when I give source it is not working as expected please help

     

  • Verified answer
    shmowlana Profile Picture
    Microsoft Employee on 28 Jan 2023 at 14:22:55
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Two years late 🙂

    But this works for me. Forward slashes causing the issue.

     

    UpdateScript.png

  • iAm_ManCat Profile Picture
    18,206 Most Valuable Professional on 15 Sep 2021 at 15:08:36
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Awesome, thanks for sharing!

  • Verified answer
    DenisMolodtsov Profile Picture
    317 on 15 Sep 2021 at 14:25:38
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    My friend Mark Doria found a solution to this issue:

    - cd to the extracted Solution folder

    - Run the following batch script:

    tar -a -c -f "Sample.zip" *

     

    The tar utility is a built-in Windows utility that creates ZIP files that Power platform does not complain about.

  • iAm_ManCat Profile Picture
    18,206 Most Valuable Professional on 05 Aug 2021 at 08:03:37
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Heya @DenisMolodtsov - the article is a solution for manually editing an msapp file to convert it to landscape/portrait, not for re-packaging the standalone Power App (which is as you say, fairly easy to do), so not quite the same as your migrator which deals with sharepoint data sources (very neat solution btw, kudos!)

     

    thanks for the shoutout @johnnyshield, hope you both have a great day

  • CU07080701-0 Profile Picture
    on 05 Aug 2021 at 07:50:55
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    My apologies, I stumbled across this thread while trawling for PowerApps app packaging & didn't take the time to read it in detail. Thanks for setting me straight.

  • DenisMolodtsov Profile Picture
    317 on 02 Aug 2021 at 23:39:54
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    @johnnyshield , Thank you, very much for sharing. But unfrortunately @iAm_ManCat didn't solve it. The article that you shared here refers to standalone apps, not so-called Power platform solutions. Packaging Standalone apps and Flows using PowerShell poses no problem whatsoever. In fact, I "solved" this 4 years ago and published as an open sourse script here: https://github.com/Zerg00s/FlowPowerAppsMigrator. It does the same thing described in the article you shared, except it does the entire thing automatically, without manual maninupations.

     

    My issue is with packaging Power Platform solutions. I tried everything under the sun to programmatically package Solutions and as a result, these zipped-up solutions simply are not accepted during the import procerure. On the other hand, standalone apps and flows that were packaged the same way have no issue whatsoever during the import. I hope it makes sense.

     

  • CU07080701-0 Profile Picture
    on 02 Aug 2021 at 23:02:11
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    @iAm_ManCat has solved this - you can download his PowerShell tool here:
    Converting a Landscape Power App to Portrait (and Vice Versa) - iAm_ManCat Blog (iammancat.dev)

  • DenisMolodtsov Profile Picture
    317 on 25 Feb 2021 at 16:20:13
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Unfortunately, I didn't find a way to generate a ZIP file programmatically. I sill need help from someone who understands how ZIP works on a low level. I gave up after spending days over this issue. 

  • Sheppounet Profile Picture
    2 on 10 Feb 2021 at 15:24:19
    Re: Power App Solution Package - Extract and Re-ZIP Programmatically

    Hi ! Have you found the solution ? I have the exact same problem ... And as for you, the answers here are not working.

    (My computer system is in French regional settings, might have a relation to the issue and it's default encoding)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
mmbr1606 Profile Picture

mmbr1606 39 Super User 2025 Season 1

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 32

#3
DBO_DV Profile Picture

DBO_DV 31 Super User 2025 Season 1

Overall leaderboard
Loading started