Usually I use React for my PCF components, and am I aware that there is a big difference between the debug and the production bundling, which can have a big performance impact. So I tried to be a good developer and deliver the right solution for production. But this time I needed an unmanaged solution, which cannot be generated with the default configuration.
Unfortunately I had some trouble to understand the documentation: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/import-custom-controls. My bad. Fortunately the community forum provided right away an answer, so I could move on. Thank you Richard Wilson!
This blog is more or less a note to myself. Maybe helps somebody else too.
To generate a solution containing a PCF component you only need to use the “pac” CLI to generate a “Solution project” (cdsproj), and add a reference to the pcf project (pcfproj), then restore the project and you can build the solution. Maybe the only thing to keep in mind is that the name of the generated solution will be the name of the directory where the cdsproj is placed. Maybe it’s a good practice to let it always be named “Solution.zip” if you consider ALM, but maybe you’ll end up in chaos if every pcf solution is called “solution.zip”
pac solution init --publisher-name <PN> --publisher-prefix <pref> pac solution add-reference --path <path to pcfproj> msbuild /t:restore
You have now two possibilities
- msbuild -> this will generate an unmanaged debug solution
- msbuild /p:configuration=Release -> this will generate a managed release solution.
But you can modify the “.cdsproj” and specify the SolutionPackageType:
- Both – this will generate two solutions : managed and unmanaged
So, it’s possible to have all combinations using the cdsproj config and msbuild /p:configuration=Release command. I’ve checked the result and the size of my test solution (my pcf had react but not office-ui-fabric or other libraries).
|cdsProj config ->||Default||Managed||Unmanaged||Both|
Size : 214 KB
Size: 47 KB
- orange are UNMANAGED solutions
- purple are MANAGED solutions
Looking at the size of the solution I can tell how important it is to use the right bundling configuration for production.