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”
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.