Dataverse Tip #4
The package type is the folder's decision, not your flag
Managed or unmanaged is not a switch you throw on the way out. The type lives in the folder, and a --packagetype that disagrees with it is refused without writing anything.
Managed and unmanaged are not two formats you pick between at build time. They are a flag inside the package, and the tooling on either side refuses to be told otherwise.
Take a managed package and ask the unpacker for the unmanaged one:
Error: Solution package type did not match requested type.
Command line argument: Unmanaged
Package type: Managed
No folder is written. Not a partial one, not a warning-then-continue - the command reads the package,
compares it to what you asked for, and stops. The same thing happens at the other end: unpack a managed
solution, then pack it back asking for Unmanaged, and you get the identical refusal.
Where does the answer live? In the folder you unpacked, in Other/Solution.xml:
<Managed>1</Managed>
That one bit is also where the _managed suffixes come from. Every AppModule_managed.xml and
{8448b78f-8f42-454e-8e2a-f8196b0419af}_managed.xml in your working tree is the packer telling you which
tree you are standing in, not something a maker typed.
The practical consequence for a pipeline is that you cannot flip a solution’s type as a build step, so the type has to be a property of the repo folder you check out. If a step reads its argument from a variable, the failure you get is a message about a mismatch that names your flag - which reads as if you typed something wrong, when the folder is what decided.