Archive

Archive for July 1, 2022

PCF component import error | Publisher prefix for this control does not match the prefix for the solution

If you are New or Beginner in Power Apps component framework , I recommend you to refer PCF beginner article first.

Coming back to the blog post, other day while importing a solution with a PCF component, solution import failed with following error

Publisher prefix XXXX for this control XX.XXXX does not match the prefix XXX for the solution with Id xxxx-xxx-xxxxxxx-xxxxx-xxxxxx"

Reason:

To understand the issue better, lets reproduce the issue by building a simple pcf control by following steps below:

  • Open Visual Studio Code and point to an empty folder.
  • Open a Terminal and execute following command to create a Control by name ‘Helloworld’.
 pac pcf init -n HelloWorld -ns sample -t field -npm true
  • Now build the control by running “npm run build” command.
  • Now that we have control in built state, let me push the control to my development Dataverse environment.
  • Execute “pac auth create –url https://myorg.crm.dynamics.com” to connect to Dataverse environment first.
  • Then, push the control to the connected environment using “pac pcf push –publisher-prefix sample command.
  • Above ‘pac pcf push‘ command creates a new unmanaged solution with naming convention “PowerAppsTools_{publisher_prefix}”.
    • In my case, a new solution “PowerAppsTools_sample” got created, as I mentioned the Publisher Prefix name as sample.
  • So far we could build a new PCF control and pushed to the Dataverse instance.
  • In my Development Dataverse environment, I already have a solution by name “MyCoreSolution” with Publisher ‘Rajeev’ having a prefix as ‘raj‘.
  • Now I want to include the PCF control which we just built to my “MyCoreSolution” solution and deploy to another environment.
  • So add the “HelloWorld” control to MyCoreSolution solution and export and save a zip file in your machine.
  • Open the new Environment and try importing “MyCoreSolution” solution, which we exported in previous step.
  • Import fails with following error
Solution "MyCoreSolution" failed to import: Import Solution Failed: CustomControls with Name sample.HelloWorld Import Solution Failed with following error: Publisher prefix sample for this control sample.HelloWorld does not match the prefix raj for the solution

Fix/Best Practice:

  • Hope you got an idea with above example on what’s wrong with solution import.
  • Because the PCF control prefix (i.e.,sample) is different than the “MyCoreSolution” solution’s Publisher prefix (i.e.,raj) we got the exception during import.
  • To avoid such issues, make sure your PCF control prefix matches with your Solution’s Publisher prefix, while importing the control to a different Dataverse environment.

🙂

Categories: PowerApps Tags: , ,