Hi there,
I'm developing my first PowerApps code component. I have been following this guide.
I'm able to upload my solution and "Publish all customizations" without any issues, but when it's time to import the component into my Canvas App then I get this error:
Doing some Googling, I found this thread. The error message is the same, but I think the cause is different. In that thread the root cause was found to be that uploading an update to a solution that removes a resource causes the issue. But this is the first time I've uploaded the solution, so I don't think that's the cause.
I don't have any unsupported resources, my only resource is a TypeScript file. My solution is unmanaged.
I would be happy to send a copy of my component to a Microsoft staff member for troubleshooting.
Thanks,
Josh
Thank you @DianaBirkelbach ! Got it now!
The mistake I’ve been making is to build a quite complex control which works in the harness, but leave testing it in an app until too late. Then discover you can get the Couldn’t import components error even though the harness works, and have to unpick everything. Moral is, test in an app right from the start…
Hi @JonathanGibbs ,
Yes
- "pac pcf push" will build and upload the PCF into your environment. For this one to work, your pac cli needs to know where to upload the component... so you need the "pac auth" first, in order to setup your connection.
- msbuild will generate a solution containing the component. You can take this solution after that, and import it into any environment you like.This one doesn't need the "pac auth". You need to
a) call "msbuild /t:restore" only once (after you've created the "cdsproj" ( pac solution init) and added the pcf project to if (pac solution add-reference)
b) after that you only need "msbuild", each time you want to generate a new solution.
Yes, the main purpose of "pac pcf push" is to upload during development. But there is a way to also upload a production version using "pac pcf push", if you don't want to use "msbuild"-way at all.
This, and all the ALM strategies are explained in the sdk: Code components ALM
Hope this helps!
@DianaBirkelbach Just come across this thread as I try to resolve a "Couldn't import components" failure. Very much feeling my way with this.
I'm confused about the routes to get from a developed component that works in the harness, to something I can use in a Power App. There seem to be three critical processes: the 'pac auth' process; the 'pac pcf push' process; and the 'msbuild /t:rebuild' process.
When the outcome doesn't work, and I get "Couldn't import components" (such a helpful error, that, ha ha..), my first thought is I've got one of these wrong, or not done them in the right order, or whatever..
Diana, your very helpful post seems to be saying 'pac pcf push' and 'msbuild /t:rebuild' are in fact alternative options. I should be using 'pac pcf push' only in development, and 'msbuild /t:rebuild' only in production. Is that right? And where does 'pac auth' fit in - if at all?
Hi @OPEC-JoshWalsh ,
Is your problem solved? If so, please mark the answer as solution, in order to let the community find it faster.
Kind regards,
Diana
Hi @OPEC-JoshWalsh ,
I've just tested the Enums in CanvasApp. It's true that you can input any text, but you can still use the enum you defined.
In my case, I can choose from the defined options.
while the Manifest for my Enum is this:
<property name="displayTextType" display-name-key="Display_text_type" description-key="Display text type" of-type="Enum" usage="input" required="true">
<value name="SIMPLE" display-name-key="No decoration" description-key="No decoration" default="true">SIMPLE</value>
<value name="BOX" display-name-key="Colorful background" description-key="Colorful background">BOX</value>
<value name="BORDER" display-name-key="Colorful Border" description-key="Colorful Border">BORDER</value>
</property>
I haven't thought to use spaces in the name, since they are the Enum properties that I use in the code. For the user, there is the "display-name-key", which can be translated too. But unfortunately I don't see that in CanvasApps.
Hope this helps!
Kind regards,
Diana
Thanks @DianaBirkelbach , that command is very useful, it makes it much quicker to try things out.
It turns out that spaces are not allowed in the "name" property of "value" nodes. I find the structure of the <value> element quite strange in general. In HTML you have a <select> element with multiple <option> elements inside it. On an <option> element, the content of the node is the displayed text, and the "value" attribute defines the underlying value of that option.
But (at least in the test harness) this behaviour is inverted in PCF. The node content is the underlying value, and the "name" property becomes the displayed text.
It doesn't seem like it matters very much though, as in PowerApps Studio's Properties pane Enum seems to be treated just like SingleLine.Text, allowing free typing instead of a dropdown.
Hi @OPEC-JoshWalsh ,
Great that you could import the component.
I have a little input to your comments:
To 2. You don't need to delete the components in order to update them. During the development phase, you can upload it using
"pac pcf push -pp <prefix>" (executed in the folder of your ".pcfproj") . This will upload the component to a solution named "PowerAppsTools_<prefix>".
When your're done with the development, and want to make a new release, you can build the solution using "msbuild", but need to increment the version number in the manifest. Just don't change the "Major" part of the number. Then you can update the component by installing the solution.
To 3: I have already components with "Enum" properties which I've imported in CanvasApps. This should work for you too.
Check your "display-name-key", "description-key" parts of your property defined as Enum, or maybe the "value" nodes inside. There is a bug: some special chars (like ' "Apostrophe" or semicolon are not treated right and it breaks your manifest import). Maybe you have an issue with that.
Kind regards,
Diana
I've discovered some things since my last post:
1. It's not mentioned in the documentation, but the version number used for the solution is the one in YourSolutionDirectory/src/Other/Solution.xml.
2. Uploading an updated solution (even with a higher version number!) does NOT update the components within that solution. You need to delete the components manually in order to upload a new version.
3. The cause of the initial error I encountered is because I am using an enum. If I remove the enum, my component works fine. This confuses me, because the enum works fine in the test harness and also is mentioned in the documentation.
Thanks @ScottDurow for your help!
Thanks for the advice, I am trying the reverse approach: gradually adding stuff to the example control until it breaks.
Unfortunately I'm hitting an issue, which is that I can't deploy an updated version of the control. I've updated the version number to 1.1 (or 1.1.0) in every location I can find (package.json, project.assets.json, TS_PRopertySetTableControl.pcfproj.nuget.dgspec.json, ControlManifest.xml), but when I upload the solution it still says 1.0 and "This version of the solution package is already installed."
It gives me the option to proceed with the import anyway, but after doing that and then clicking "Publish all customizations", when I add the component to a canvas app it's still the first version. (I know it's not the new version because in my most recent version I've commented out all the code for adding DOM elements, but the DOM elements are still being created)
Is there something obvious that I'm missing for how to bump the version number?
Yes that is frustrating - do you get any more info from the the down chevrons to the right of the ping bar?
Next steps would be to strip back your control until it basically looks like the sample until it works.
Often there can be something in the control that doesn't agree with the CanvasApp JavaScript runtime.
WarrenBelz
85
Most Valuable Professional
Michael E. Gernaey
65
Super User 2025 Season 1
mmbr1606
55
Super User 2025 Season 1