Power Platform Hack: Turning a Managed solution into Unmanaged
Tags: powerplatform, powerautomate, powerapps
Published: 2024-06-25 16:36:41



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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0quwa5evba6jri3bmsi.png)

_"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:

```xml
<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> 

```

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2967345i1tm34i5xu5nx.png)


## 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`.

> •	<Managed>1</Managed>: 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.”
	•	<Managed>0</Managed>: 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 <Managed> 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:

```xml
<Managed>0</Managed>
```

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q97hge33gj8at572mxjd.png)
    _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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2jdqspgqr4dsxrnmhucq.png)


3. **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 🚀