Tuesday, October 6, 2015

How to convert a Managed solution component to Unmanaged solution component

Hi


Sometimes we need to have a copy of a plugin from a CRM environment for different reasons say for back up before deploying new versions of it. If it is unmanaged solution you can export it.

What about a managed component?

You cannot export a managed solution. Then you can create an unmanaged solution and add specific plugin components in the newly created unmanaged solution.

Even though you export that solution, you can’t see the managed plugin assemblies in the exported files. CRM will avoid to add those files.



So How do we add those managed components?


Here is the method to convert managed plugin assemblies to unmanaged!

Note: It is un-supported

Of course you need Data base access to do the actions in behind. Go to CRM Data Base. 

Try Below query.

select IsManaged,SolutionId,* from PluginAssembly where Name='PluginName'

Keep the solutionid safe to replace it back after your play

Now try below Query.

declare @systemSolutionId uniqueidentifier
select @systemSolutionId = solutionid from SolutionBase where UniqueName='Active'
update PluginAssembly
set IsManaged=0,
SolutionId=@systemSolutionId
where Name='PluginName'

This will make your plugin assembly free from the prison of managed. Now it is unmanaged. You can do all the process what ever you expected to do in Unmanaged components

Export the unmanaged solution you can see the plugin assembly folder in the zip file



Enjoy!


Wait Rollback the changes if you want to go back to the original

update PluginAssembly
set IsManaged=1,
SolutionId=’<Original Solution Id>’
where Name='PluginName'

You can apply same technique for any other items


No comments: