Power Platform Hack: Turning a Managed solution into Unmanaged

Fernanda Ek - Jun 25 - - Dev Community

Hey folks! 👋 I’ve got quite a story to share about a little sweaty moment I had with Power Platform. If you’ve ever had a situation where you needed to convert a managed solution into an unmanaged one, keep reading… I’ve got a trick for you.

How it all started: Importing

So there I was, trying to import a solution back into my Power Platform environment. I got this error:

Image description

"The import solution must have a higher version than the existing solution it is upgrading."

Honestly, I wasn’t sure how to fix it 😵‍💫

The Discovery

Not one to give up easily, I decided to dig into the solution file itself. I unzipped the solution and opened the solution.xml file. This file contains all the details of your solution. Here’s a peek at the code:

<ImportExportXml version="9.2.24052.196" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SolutionManifest>
    <UniqueName>QMS</UniqueName>
    <LocalizedNames>
      <LocalizedName description="QMS" languagecode="1033" />
    </LocalizedNames>
    <Descriptions />
    <Version>1.0.0.4</Version>
    <Managed>0</Managed>
    <Publisher>
      <UniqueName>xxxxxxxxx</UniqueName>
      <LocalizedNames>
        <LocalizedName description="xxxxx" languagecode="1033" />
      </LocalizedNames>
      <Descriptions />
      <!-- Other tags omitted for brevity -->
    </Publisher>
    <RootComponents>
      <!-- Components list -->
    </RootComponents>
    <MissingDependencies />
  </SolutionManifest>
</ImportExportXml> 

Enter fullscreen mode Exit fullscreen mode

I noticed the <Version> tag and thought, “What if I just bump up the version number?” So, I changed <Version>1.0.0.4</Version> to something higher, like <Version>1.0.0.7</Version>, saved the file, zipped it back up, and tried importing it again. Success! 🎉

Image description

The “Eureka” moment with <Managed>

While I was poking around, another tag caught my eye: <Managed>. It was set to 0, which means it was an unmanaged solution.

Note: In the context of many programming languages, 0 and 1 are used as Boolean values to represent false and true, respectively.

Curious, I wondered what would happen if it was a managed solution, if it was set to 1🤔 Then I decided to test it out with a managed solution… I changed it to 0.

• 1: This means the solution is managed. Managed solutions are typically used in production environments where you don’t want users to modify the solution directly. The 1 here is like saying “Yes, this is managed.”
• 0: This changes the solution to unmanaged. Unmanaged solutions are often used in development environments because they allow for direct modifications. The 0 here is like saying “No, this is not managed.”

So, by changing the tag from 1 to 0, you’re effectively telling Power Platform that the solution should no longer be treated as a managed solution, allowing you to edit and customize it freely.

So, I did just that:

<Managed>0</Managed>
Enter fullscreen mode Exit fullscreen mode

I saved the file again, zipped it up, and imported it back into my environment. And guess what? The solution was now imported as an unmanaged solution! 🎉

Here’s how to do it

  1. Unzip and Edit:
    • Unzip the exported file and open solution.xml.
    • Change the <Managed> tag from 1 to 0.

Image description
If you’re facing a version issue, update the <Version> tag to a higher number.

I find it easier opening it directly in Visual Studio Code, you can of course open with notepad as well.

Image description

  1. Zip and Import:

    • Zip up the files and import the solution back into your environment.

    Voilà! You now have an unmanaged solution.

When to use this trick

Managed solutions are great for deploying stable versions to production environments but if you ever need to modify something or if you’ve somehow lost your unmanaged version and need to make changes, this little trick can save you tons of time.

Conclusion

While this trick works, it’s more of a workaround than an official method. Use it wisely and always keep backups of your solutions. Also, keep in mind that this might not be suitable for all scenarios, especially in production environments where stability is key.

I hope this helps you out as much as it did for me 🚀

. . . . . . . . . . . .