Solution packaging Tip #21
Unpack a second solution into the same folder and pac will not pack it
pac solution unpack prints 'Not deleting files' and leaves the earlier solution's components behind, so the next pack fails RootComponent validation.
Unpack a second solution into a folder that already holds one and pac tells you what it is doing:
Not deleting files
Unpacked Solution.
That line is the whole warning. pac solution unpack writes the second solution’s Other/Solution.xml over
the first one’s, so the folder’s identity becomes the solution you just unpacked, and every component folder
the first solution brought is still sitting beside it. The folder now describes one solution and contains the
root components of two.
The failure lands at pack time:
Following objects, required by the solution, are not present.
Type='WebResource', Id (or schema name)='WebResource-sample_/metadatabrowser'.
Type='SiteMap', Id (or schema name)='SiteMap-sample_MetadataBrowser'.
Type='AppModule', Id (or schema name)='AppModule-sample_MetadataBrowser'.
Error: RootComponent validation failed.
Read that list carefully, because it is misleading: no object is missing from your source system and no
dependency is broken. The same run lists sample_/metadatabrowser under Processing Component: WebResources
two lines after calling it absent. Those are the previous solution’s components, and the new Solution.xml
knows nothing about them, so the packer cannot place them in the package it builds.
It bites hardest in a build that keeps one workspace folder and unpacks whatever export it is handed: the first solution goes fine, then a different export arrives and the build starts failing on a dependency error that describes files sitting right there on disk. Chasing the dependency is a dead end.
Unpack into an empty folder. Delete the workspace before each unpack instead of reusing it:
pac solution unpack --zipfile SolutionOne_1_0_0_0_managed.zip --folder work --packagetype Managed
pac solution unpack --zipfile SolutionTwo_1_0_0_0_managed.zip --folder work --packagetype Managed
pac solution pack --zipfile out.zip --folder work --packagetype Managed
Delete work, unpack only the second zip, and that pack succeeds.