How to Correctly Deploy a Power Apps Component Framework Custom Control

Adam Murchison, 11 December 2019

When deploying a Custom Control, I noticed that the Custom Control was not updating from the previous version. I struggled to work out why this wasn’t overwriting the previous version of the Custom Control, so I was removing the dependencies and deleting it, then re-deploying the Custom Control each time I wanted to update it.

I worked out a few neat tips on deploying the Custom Control and thought I’d pass the knowledge on! Firstly, I’ll give you a quick run down on how to build and deploy the Custom Control for the first time.

Commands to Build the Custom Control

Firstly, we’ll briefly go over how to build a Custom Control so that you can deploy it to your Dynamics 365 environment. You’ll want to run your commands from the below application:

Run these commands from your Custom Control file directory, for example my folder is under the file directory C:\Users\adam\Documents\AdamsPCF so I type the below command:

This directs your CMD line to the component you’re wanting to deploy. Here we run the command mkdir <SOLUTIONNAME>, in this example my Custom Control is called ‘ColourInput’ so I replace <SOLUTIONNAME> with ‘ColourInput’. Then we type the command ‘cd <SOLUTIONNAME>. The solution name will be the name of your Custom Control, so name this wisely. Once we’re in the solution folder we run the following commands which build and create the ZIP file which you then import into your Dynamics 365 environment.

pac solution init --publisherName <PUBLISHER NAME> --customizationPrefix <PREFIX> 

pac solution add-reference --path ".." 

msbuild /t:restore 

msbuild 

In your solution folder, go to bin/debug and you should see your .ZIP file here as shown below

Updating the Custom Control

Next time you’d like to deploy your Custom Control simply go to the ControlManifest.Input.Xml and increment the version number, this is crucial when deploying the Custom Control as this will solve the issue where the Custom Control doesn’t overwrite the previous version. This is shown below:


You can see the version number is 0.0.1, the initial number was 0.0.0 so this overwrites the previous version.

Now we simply run the following commands from the solution folder:

msbuild /t:restore

msbuild

Then you can deploy the solution to Dynamics 365 to update your Custom Control.

Summary

The Microsoft documentation isn’t entirely clear and there may be some people out there who missed these crucial steps just like I did. You can read Microsoft’s documentation here. I hope this helps others who are venturing into the world of Custom Controls.