LowCodeStacks™
Sign in

Fix "The solution file is invalid" when you import a solution

The .zip you imported doesn't have a solution's three files at its root. It's a package, not a solution, or it was zipped again by hand. How to tell, and fix it.

Power AppsFix a problem7 min read

Checked against Microsoft Learn · 13 sourcesPosted by the Maker DeskHow we write guides

You start a solution import in Power Apps or Power Automate, pick the .zip, and the import fails with: "The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported." Nothing was imported and nothing in the environment changed. Dataverse opened the .zip, looked for the three files every solution has at its top level, and didn't find them. Either the file was never a solution, or its contents moved when someone unzipped and zipped it again.

What Dataverse checks when you import a solution .zip. A valid solution, here LowCodeStacksExpenses_1_0_0_1.zip, has three files at its root: [Content_Types].xml, customizations.xml and solution.xml, beside folders for components such as Workflows. Dataverse imports it. Three kinds of file fail the check, with error 80048060. First, a canvas app package or a flow package, exported as a package rather than in a solution: packages aren't solutions, and have their own import. Second, a solution that was unzipped and zipped again with only customizations.xml in it, or with its files inside a folder instead of at the root. Third, a file from an earlier version of Dynamics 365, which isn't supported. The fix: import packages with Import canvas app or Import Package (Legacy), compress the solution's files themselves or use pac solution pack, or export the solution again from its source environment.
A solution .zip must have its three files at the top level; packages and re-zipped folders don't.
  • A solution import in Power Apps or Power Automate fails with The solution file is invalid.
  • Code or tools report error 0x80048060 (-2147188640), named ImportCustomizationsBadZipFileError.
  • The .zip came from exporting a canvas app or a flow as a package, from a colleague who edited it, or from an old system.

What Dataverse checks

Microsoft lists this exact message among Dataverse's web service errors:

NameCodeMessage
ImportCustomizationsBadZipFileError0x80048060 (-2147188640)The solution file is invalid. The compressed file must contain the following files at its root: solution.xml, customizations.xml, and [Content_Types].xml. Customization files exported from previous versions of Microsoft Dynamics 365 are not supported.

A solution is a .zip whose root, the top level when you open it, holds those three files: solution.xml, customizations.xml and [Content_Types].xml. Components sit in folders beside them; exported flows, for example, are JSON files in a Workflows folder. If any of the three isn't at the root, the import stops with this error.

To look for yourself, open the .zip in your file explorer without extracting it. If the first thing you see is a single folder, or files with other names, you've found the problem.

A package is not a solution

Power Apps and Power Automate both make .zip files that aren't solutions:

What you haveWhere it came fromImport it with
A canvas app packageExporting a canvas app as a package, from its menu in the apps listApps > Import canvas app in Power Apps
A flow packageExporting a flow that isn't in a solution as a package (.zip)My flows > Import > Import Package (Legacy) in Power Automate

Microsoft says both kinds of package can't be used with Dataverse solution packages, because the formats are incompatible. So importing one through Solutions fails, and the fix is the import that matches it, not a repair to the file.

If you want the app or flow in a solution from now on, import the package first, then add the app or flow to a solution in that environment and export the solution. Microsoft recommends solutions for moving work between environments; packages don't support application lifecycle management.

A solution that was unzipped and zipped again

Microsoft's own example of this error: someone extracted a solution .zip, edited customizations.xml, and zipped up just that one file. The other two files were missing, so the import failed. Its fix is to select all of the files that were in the original .zip and compress them together.

The same rule catches a common slip: compressing the folder that holds the files, rather than the files themselves. The three files then sit one level down, inside that folder, instead of at the root.

A better way to change a solution's files is the Power Platform CLI, which replaced the older SolutionPackager tool for this job:

powershell
pac solution unpack --zipfile C:\work\LowCodeStacksExpenses.zip --folder C:\work\LowCodeStacksExpenses
# edit the files in the folder, then:
pac solution pack --zipfile C:\work\LowCodeStacksExpenses-edited.zip --folder C:\work\LowCodeStacksExpenses

pac solution unpack lays the files out for source control, in a different shape from the .zip (in the classic layout, Solution.xml and Customizations.xml sit in an Other folder). So don't zip an unpacked folder by hand; pac solution pack puts everything back where a solution needs it.

Warning

Microsoft supports editing only certain parts of customizations.xml, and editing a managed solution's files isn't supported at all. Invalid XML gets a different error at import: "This solution package cannot be imported because it contains invalid XML" (error 8004801a), whose technical details point to the schema validation failure.

Export it again

If the file wasn't a package and nobody edited it, it may be from an older system, renamed from something else, or damaged on the way. The reliable fix is a fresh export:

  1. In the source environment, open the solution and export it as managed or unmanaged, as the target needs.
  2. Download the .zip and import that file unchanged.
  3. Only import solutions from a source you trust; Microsoft's import page says so too.

The message itself names one case you can't fix by repacking: customization files exported from previous versions of Microsoft Dynamics 365 aren't supported. Those need to come from a current environment.

ErrorWhat it means
This solution package cannot be imported because it contains invalid XML (8004801a)The .zip is a solution, but its XML fails schema validation, usually after hand edits
… requires solutions that are not currently installed. Import the following solutions before Importing this one.Another solution must be imported first
Import failed due to missing dependenciesA component the solution needs isn't in the target environment; see move a flow into a solution and fix missing dependencies
A file over 95 MBOver the maximum size of a solution file, a different limit

Do

  • Open the .zip and check the root before you import.
  • Use Import canvas app or Import Package (Legacy) for packages.
  • Use pac solution unpack and pac solution pack to edit a solution's files.

Don't

  • Don't rename a package's .zip and import it as a solution.
  • Don't compress the folder that holds a solution's files; compress the files.

Sources

Add LowCodeStacks as a preferred source on Google

Did this fix it?

Comments

No comments yet. Share what worked for you.

Sign in to comment. Comments show under a display name you choose, never your email.