Many times we have a situation and thought of deleting Components from a Managed Solution using Solution Import.
Here is the example scenario
“I have a field in an entity. After deploying a managed solution to production, we decided we don’t need that field any longer. I removed it from my development environment. When I deploy an updated version of managed solution in production, the old field is still there.”
Now it is possible with CRM 2016 by Cloning a Solution and here are the steps for the same.
I have a created a solution with two entities in it. This is my original Solution.
Export the solution and import to the Target CRM Instance.
On Source Instance, select the solution and click on Clone Solution. Just before click that, note down the version of the solution.
Once you click on Clone Solution, it gives a popup where Version is auto incremented. Click on Save.
The existing solution will be over-ridden by the cloned solution with change in the version.
Open the cloned solution and delete the entity/components which you want. I have deleted “DeleteThis” entity from the solution.
Export the Managed Solution and import to Target Instance.
While Importing you will get screen as below. Select Stage for upgrade checkbox as we are upgrading the solution.
After import, you see CRM 2016 will create a solution named same as your solution, but with a suffix ‘_Upgrade’.
Click on Apply Solution Upgrade button. It will take couple of minutes and CRM will automatically manage to delete the component for you, and at successful completion of this step, you will only have one final solution. The entity/component which you have deleted will be no longer be exists on the destination instance.
Hope this helps.