Backing up plugin/workflow assemblies

One of the ways to quickly backup the plugin/assemblies that are stored in the MSCRM database is to use the Assembly Recovery Tool that comes with XrmToolBox. Recently, I had a situation where I couldn’t back up the assembly this way, as one of the assembly was huge and the OrganizationService was experiencing some latency issues, resulting in a slow performance of the Assembly Recovery Tool.

I followed the method below to quickly backup the assemblies straight from the database.

Install CShell. I prefer this over Linqpad for quickly running C# snippets because you get intellisense for free and it also has a REPL window.

Run the query which is below in SQL Server Management Studio, against the MSCRM database

SELECT [Name],[Content] FROM dbo.PluginAssemblyBase WHERE IsHidden=0

Right click on the result and choose “Save Result As” from the context menu and specify the file name and the location