Here we will understand to streamline and optimize assembly development in Power Apps / Microsoft Dynamics 365. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
In Power Apps / Dynamics 365, plugins are custom .NET assemblies that can be registered to execute business logic in response to specific events or triggers within the platform. These assemblies can be written in C# or other .NET languages and are often used to extend or customize the behavior of Power Apps. Workflows assemblies, on the other hand, are similar custom code components associated with workflows in Dynamics 365.
Registering an assembly includes uploading the assembly to the Dataverse database, which is handled by the ‘Plugin Registration Tool‘. You can easily create and updates assemblies using the PRT tool for supporting your extended features in Power Apps.
Further, you can view information about registered plug-in assemblies & the plug-in assembly steps / images in the Power Apps under the solution explorer and PRT tool.
When developing custom assemblies, several factors need to be taken into account & few and listed below:
- Sandbox assembly size is limited to 16 MB in Microsoft Dataverse.
- Assemblies with a large number of custom workflows can take much longer time to upload when assembly is being registered.
- Multiple different custom assemblies can lead to increase in complexity, increase of maintainability & potential increase in plug-in execution length.
Limit your assembly size below 16 MB.
Your assembly might contain various custom plug-in classes or types, and even custom workflow activites; however, its size must not exceed 16 MB. It is advisable to combine plug-ins and workflow assemblies into a unified assembly, ensuring that the size stays below the 16 MB limit.
Restrict the number of Custom Workflow Activities within a single custom assembly.
When an assembly that contains custom workflow activities is uploaded in Dataverse using plug-in registration, an additional checks are required for custom workflow activities. The reason for this is that an assembly with numerous regular plug-in types can be swiftly uploaded, an assembly containing over 100 custom workflow activities might take several minutes or even timeout during registration or updates. Thus it is advised to limit the number of custom workflow activities to no more than 50 in a single assembly.
Combine Plug-ins or Custom Workflow Activities into a Unified Assembly.
Plug-ins and custom workflow activities created for a Dataverse solution should coexist within a single Microsoft Visual Studio project. Contemplate merging individual plug-ins and custom workflow activities into a unified Visual Studio project/assembly, except in cases where the plug-ins meet the following exceptions:
- There will be more than 50 custom workflow activities in the assembly as mentioned above.
- A plug-in or custom workflow activity needs to be selectively deployed to one environment but not to other environments.
- The physical assembly size is near or greater than 16 MB for a Dataverse instance as mentioned above.