Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pac solution unpack --allowDelete --processCanvasApps will delete canvas app source if run a second time #334

Closed
filcole opened this issue Oct 30, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@filcole
Copy link

filcole commented Oct 30, 2022

The allowDelete and processCanvasApps flags on pac solution unpack seem incompatible. With a solution that contains a canvas app, e.g. a model driven app with a new Power Fx component library, then the first unpack will process and expand the solution and associated canvas app (.msapp) correctly. If the same command is run again the files in CanvasApps\src\* are deleted.

First Unpack

❯ pac solution unpack --folder PacSolutionUnpackCanvas --allowDelete --processCanvasApps --zipfile .\PacSolutionUnpackCanvas_1_0_0_1.zip

Unpacking Solution...

Extracting C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas_1_0_0_1.zip to C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas

Skipping localization
Processing Component: Entities
 - pgc_PrimeMinister
Processing Component: EntityRelationships
Processing Component: AppModuleSiteMaps
 - pgc_PrimeMinisterApp
Processing Component: AppModules
 - pgc_PrimeMinisterApp
Processing Component: CanvasApps
 - pgc_primeministerappdefaultcommandlibrary_b5677

-- unpacking Canvas app pgc_primeministerappdefaultcommandlibrary_b5677...
Unpack from C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas\CanvasApps\pgc_primeministerappdefaultcommandlibrary_b5677_DocumentUri.msapp --> C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas\CanvasApps\src\pgc_primeministerappdefaultcommandlibrary_b5677
  source format version: 0.24

Unmanaged Extract complete.


Unpacked Solution.

image

Second Unpack

❯ pac solution unpack --folder PacSolutionUnpackCanvas --allowDelete --processCanvasApps --zipfile .\PacSolutionUnpackCanvas_1_0_0_1.zip

Unpacking Solution...

Extracting C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas_1_0_0_1.zip to C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas

Skipping localization
Processing Component: Entities
 - pgc_PrimeMinister
Processing Component: EntityRelationships
Processing Component: AppModuleSiteMaps
 - pgc_PrimeMinisterApp
Processing Component: AppModules
 - pgc_PrimeMinisterApp
Processing Component: CanvasApps
 - pgc_primeministerappdefaultcommandlibrary_b5677

-- unpacking Canvas app pgc_primeministerappdefaultcommandlibrary_b5677...
Unpack from C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas\CanvasApps\pgc_primeministerappdefaultcommandlibrary_b5677_DocumentUri.msapp --> C:\Users\...snip...\allowDelete\PacSolutionUnpackCanvas\CanvasApps\src\pgc_primeministerappdefaultcommandlibrary_b5677
  source format version: 0.24

Unmanaged Extract complete.


There are 18 unnecessary files
Deleting files...

Unpacked Solution.

Notice 18 unnecessary files reported and deleted! Checking the file system we can see the canvas apps source files have been deleted. 😱

image

Here's the solution zip used for testing. It contains a table 'Prime Minister', a 'Prime Minister App', a component library adding a 'Replace Incumbent' button to the main form on the 'Prime Minister' table.

PacSolutionUnpackCanvas_1_0_0_1.zip

@milouren
Copy link

I also have this issue

@davidjenni davidjenni added the bug Something isn't working label Dec 12, 2022
@mikefactorial
Copy link

Looks to be the same issue as here microsoft/powerplatform-build-tools#135

@RobNightingale-LSL
Copy link

I also have this issue

@RobNightingale-LSL
Copy link

@filcole did you try the following flag in the build task in the advanced section?
OverwriteFiles: false

This looks, from my testing, to add/remove 2 parameters, one being the offender!:
--allowDelete true
--allowWrite true

The defaults for both these parameters are false so has potential, but feels counter intuitive to turn off allowWrite.

@filcole
Copy link
Author

filcole commented Dec 13, 2022

No. I experienced the issue when using pac directly in a PowerShell script. I'm not sure what the PPBT ADO tasks are issuing, but I think you can normally see in the logs.

@petrochuk
Copy link
Contributor

Fixed in latest versions of PAC CLI and other libraries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants