Part 5 – Build, Test and Deploy your Power Apps Component Framework (PCF) Custom Control

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at

The article is a part of series of blog posts on Custom component framework topic. In order to get the context I would suggest to get started from beginning.

Now that we have developed our control in the previous article it’s time to build, test and deploy.

The first is to build your component. To build you need to open Visual Studio 2017 developer command prompt and navigate to folder where your code file is there (index.ts).

In my case it is c:\Debajit\Blog\PowerControls\FileControl


Once in the directory, run the command “npm run build”


As you can see, Build is successful. Now it’s time to test whether your control is rendering correctly before we deploy it to CRM.

Just type “npm start” in command line. It will launch IE process and show you. As you can see from screenshots my file control with submit button is rendered successfully. Look’s ugly but works just fine.


So build successful and tested as well. Now we need to put in CRM. But how?

The first thing we need is to create a solution file (zip archive) and bundle our custom component inside that solution. Before I do that, I create a new folder called “Deployment” inside my “PowerControls” folder and navigate to that folder from Visual studio command prompt. In my case the full path is “C:\debajit\blog\powercontrols\deplpoyment”.

I then run the below command

pac solution init --publisherName <enter your publisher name> --customizationPrefix <enter your publisher name>

Here in publisher name I put – “xrmforyoucontrols” and in customizationPrefix I put – x4uctrl. So my command line is

pac solution init --publisherName xrmforyoucontrols --customizationPrefix x4uctrl. Basically it creates a publisher with the specified customization prefix.

You will get notified in the console that deployment is successful.


The next step is to add our custom control reference. To do this run the below command.

pac solution add-reference --path <path or relative path of your PowerApps component framework project on disk>

Please note here that the path is till the directory where your component directory resides. My component directory is “FileControl” and is within C:\Debajit\Blog\PowerControls


To generate the solution zip file, the final step is to run first – “msbuild /t:restore” and then once that is completed, run “msbuild”

MSBUILD /t:restore




And finally when I open my deployment folder, I could see bin folder. Navigate inside bin\debug and you would find your solution file.


Import the solution file into your environment and publish all customizations.


The final step is using the control in CRM which is covered in the next article.


16 thoughts on “Part 5 – Build, Test and Deploy your Power Apps Component Framework (PCF) Custom Control”

  1. Hello Debajit, amazing job! really!

    But, I got stuck up in the step when you have to write the “add reference” command in order to add reference to solution. My script looks like “pac solution add reference –path “My path”” But not successfully. It says me, that is not a valid command. However, I tried to build without the previous step, and don’t get the “ZIP” file as an outcome.

  2. Please ignore my last comment as I managed to resolve the issue.

    The issue was due to the space in the Folder Name CRMKNOWHOW BLOG instead of CRMKNOWHOWBLOG.

    Thanks for sharing the detailed information (Step-by-Step) on PCC.

  3. Hi Debajit. I’m kinda stuck. I did a timer control using pcf and it run fines locally. If I take the solution to D365 and adding this custom control to a text field, nothing shows up. Can you please help me out?

    1. Hi Arthur..thanks for reading my blog..I guess it was –publisherName (two hypens) only last time i developed. If you see the screenshot below the command, it is working. Didnt check with the latest version though.


  4. I keep getting this error in the last command – ‘msbuild’ is not recognized as an internal or external command,
    operable program or batch file.

  5. hi Debajit,
    Yes I am using VS command prompt, I have had to set the path of my MSbuild in the VS command prompt, but now getting this error- Deployment.cdsproj(25,70): error MSB4066: The attribute “Ve
    rsion” in element is unrecognized. Build Failed.

  6. hi,
    I am getting all sorts of errors, which you never mentioned. And finding solutions to command line errors is almost close to impossible, as the erros are all vague and can relate to almost every application out there. currently getting this error now – “C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.tar
    gets(114,5): warning : The plugin credential provider could not acquire credentials. Authentication may require manual
    action. Consider re-running the command with –interactive for `dotnet`, /p:NuGetInteractive=”true” for MSBuild or remo
    ving the -NonInteractive switch for `NuGet`.”

  7. Hi Debajit,
    Nive Articles! I am creating my first PCF component following your steps mentioned in these aritcles.
    I am able to create deploment packge ZIP file. But I m stuck at last step of part 5. While trying to import Zip file, its giving me exception.
    “You do not have {0} permission to access {1} records. Contact your microsoft dynamics 365 administartor for help.”
    I tried to import under solution tab.
    I have O365 license . Do any special licensing required to use custom component in powerapps.
    Till now I have not used any special connector, just trying to use this file upload custom control to know how PCF work.
    Can you please suggest if I have missed anything!

    1. Thanks..At first glance it seems more of like you are missing system customizer privilege in Dynamics 365. Could you give yourself a system customizer or system administrator role and try.


Leave a Reply