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
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.
- A solution import in Power Apps or Power Automate fails with
The solution file is invalid. - Code or tools report error
0x80048060(-2147188640), namedImportCustomizationsBadZipFileError. - 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:
| Name | Code | Message |
|---|---|---|
ImportCustomizationsBadZipFileError | 0x80048060 (-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 have | Where it came from | Import it with |
|---|---|---|
| A canvas app package | Exporting a canvas app as a package, from its menu in the apps list | Apps > Import canvas app in Power Apps |
| A flow package | Exporting 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:
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:
- In the source environment, open the solution and export it as managed or unmanaged, as the target needs.
- Download the .zip and import that file unchanged.
- 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.
The related import errors
| Error | What 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 dependencies | A 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 MB | Over 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 unpackandpac solution packto 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
- The solution file is invalid error occurs in Microsoft Dynamics 365 — Microsoft Learn
- Web service error codes: Microsoft Dataverse errors — Microsoft Learn
- Import solutions — Microsoft Learn
- Import a solution (Power Automate) — Microsoft Learn
- Export a solution: flows in the Workflows folder — Microsoft Learn
- Overview of exporting and importing canvas apps — Microsoft Learn
- Export and import canvas apps as a package — Microsoft Learn
- Export and import a non-solution flow — Microsoft Learn
- CoE Starter Kit FAQ: import a flow (Import Package (Legacy) screenshot) — Microsoft Learn
- pac solution: unpack and pack — Microsoft Learn
- SolutionPackager tool — Microsoft Learn
- When to edit the customizations file — Microsoft Learn
- This solution package cannot be imported because it contains invalid XML — Microsoft Learn
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.