Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Converting unmanaged solutions to single managed solution

(0) ShareShare
ReportReport
Posted on by 29

We have an old CRM instance with multiple publishers and prefixes, all unmanaged, that have accumulated over years - with many interdependencies between all the publishers and objects.  We would like to move to managed solutions only - and start using ALM using a single publisher going forward.

 

Trying to separate these cleanly into different solutions by publisher and then converting to managed doesn't seem to make sense given dependency issues.

 

Questions:

  1. Is it safe to merge multiple publishers into single solution in order to enable ALM?
  2. How can one find and add all unmanaged objects to a single solution, given there are many thousands of them across many component types?  (it isn't feasible to inspect each object and add manually to a solution)
  3. Any scripts or techniques to reliably get all unmanaged components into a solution so they can be converted to managed in a one-time fashion?

Thank you!

  • taylorgmojo Profile Picture
    29 on at
    Re: Converting unmanaged solutions to single managed solution

    Hey Allan, thanks! I was able to follow this basic strategy and am now using source control and ALM properly!  Wow, what a relief! 

  • Verified answer
    AllanDeCastro Profile Picture
    412 Most Valuable Professional on at
    Re: Converting unmanaged solutions to single managed solution

    Hello @taylorgmojo ,


    Migrating from an unmanaged CRM instance with multiple publishers to a managed solutions approach can be challenging due to the interdependencies and sheer volume of components involved. Here are detailed answers to your questions and steps to help you achieve this:

    1. Is it safe to merge multiple publishers into a single solution to enable ALM?

    Yes, it is generally safe to merge multiple publishers into a single solution to facilitate ALM (Application Lifecycle Management). This approach helps streamline your development and deployment processes. However, careful planning and execution are required to handle dependencies and ensure that nothing breaks during the transition.

    2. How to find and add all unmanaged objects to a single solution?

    Given the vast number of components, manually inspecting and adding each object is impractical. Instead, you can automate the process using PowerShell scripts and the Dynamics 365 Web API.

    3. Scripts or techniques to get all unmanaged components into a solution

    Here’s a step-by-step approach to automate the process, you can do it manually bue also try in a programatically way:

    Prerequisites:

    • PowerShell installed on your system.
    • Microsoft.Xrm.Data.PowerShell module to interact with Dynamics 365.

    Steps:

    1. Install the Dynamics 365 PowerShell Module:

       

     

    Install-Module -Name Microsoft.Xrm.Data.Powershell

     

    • Connect to Your CRM Instance:

       

     

    $crmConn = Get-CrmConnection -InteractiveMode

     

    • Retrieve All Unmanaged Components: Use a PowerShell script to fetch all unmanaged components from the CRM instance and add them to a single solution.

       

     

    # Load required assemblies
    Add-PSSnapin Microsoft.Xrm.Tooling.Connector
    
    # Connect to the CRM organization
    $conn = Get-CrmConnection -InteractiveMode
    
    # Solution unique name where you want to add components
    $solutionUniqueName = "NewManagedSolution"
    
    # Function to add an entity to a solution
    function Add-EntityToSolution($entityLogicalName) {
     $addReq = @{
     ComponentType = 1 # Entity
     ComponentId = (Get-CrmEntityMetadata -conn $conn -EntityLogicalName $entityLogicalName).MetadataId
     SolutionUniqueName = $solutionUniqueName
     }
     Add-CrmSolutionComponent @addReq
    }
    
    # Function to add all unmanaged entities to the solution
    function Add-AllUnmanagedEntitiesToSolution {
     $entities = Get-CrmEntityMetadata -conn $conn -EntityFilters Entity
     foreach ($entity in $entities) {
     if ($entity.IsManaged -eq $false) {
     Add-EntityToSolution -entityLogicalName $entity.LogicalName
     }
     }
    }
    
    # Execute the function to add all unmanaged entities
    Add-AllUnmanagedEntitiesToSolution

     

    • Convert the Solution to Managed: After all components are added to the new solution, export the solution as unmanaged, and then re-import it as managed.

      • Export Solution as Unmanaged: Go to your Dynamics 365 environment, and export the newly created solution as an unmanaged solution.

      • Re-import as Managed:

        • Before importing, make sure to check the box for “Activate any processes and enable any SDK message processing steps included in the solution” and ensure that “Stage for Upgrade” is selected if you need to upgrade existing managed solutions.
        • Import the solution back as managed.

    Additional Considerations:

    • Test in a Sandbox Environment: Perform these steps in a sandbox environment to ensure that everything works as expected before applying changes to the production environment.
    • Backup Your Environment: Always take a full backup of your CRM instance before making significant changes.
    • Review Dependencies: Carefully review and resolve any dependencies during the migration process. This might require some manual intervention and testing to ensure all components function correctly.
    • ALM Best Practices: Once the initial migration is complete, establish ALM best practices using tools like Azure DevOps for source control, build, and deployment pipelines to manage your managed solutions effectively.

    By following these steps, you can consolidate your unmanaged components into a managed solution, streamline your CRM environment, and enable effective ALM practices going forward.



  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Converting unmanaged solutions to single managed solution

    I don't think you'll like the answers:

     

    1. Yes, If your various solutions share a prefix. Conflicting publishers can often mean conflicting prefixes, and this is a problem for bundling a managed solution. A managed solution can ONLY contain components with its associated publisher's prefix so, for example, if you settle on xyz_ and you try to include a table abc_mytable Dataverse will refuse the solution because the prefix doesn't match. In that scenario, the only way to merge those components would be to rebuild them under a unified prefix (note: the publisher doesn't need to match: just the prefix).

    2. All unmanaged solution components are kept in the Default solution layer. If you open the Default solution, you will see them all. Unfortunately, this does not help you because practically EVERYTHING is in the default solution layer, whether you use it or not. 

    3. I don't have a ready-made script for you, but the unmanaged solutions you have right now are probably the right place to start. If it were me, I would write a program to read in the solutions one at a time and build an XDoc from them, then carefully merge those XDocs to build one solution, editing publisher prefixes as I go. This will not be quick or easy; you will find that solution XML is complex and often unordered, making it challenging to merge components authoritatively. Manual review and hand-merging will probably be necessary in many circumstances, so I don't recommend this path for anyone that isn't VERY comfortable with solution XML.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard