I created a simple button component to test the code components framework. I build the solution and uploaded/published it successfully.
In a powerapp, after enabling components, I see my component in the import window. However, when I actually try to add it to my PowerApp I always get the error "Couldn't import components".
No other error message is displayed, and the component isn't added. Is there somewhere I can see what the actual issue is, and how I can solve this?
Looking at the project you provided, it looks like you are building the solution as unmanaged. Removing an unmanaged solution won't actually remove the components, which is a limitation to unmanaged whereas managed doesn't have this issue. Managed has other restrictions however as that's only really meant for deployment (although I still use it personally for testing as uninstalling is nice).
I can ask around for the best way to clean up the older files, but you can also try publishing a newer version and hitting "Publish all customizations". You can also change the name of the control and it will see it as a new control and won't have this issue.
If you can remember the steps on how you got to this state, that would be helpful as CDS shouldn't be having the control files in this state, whatever it is...
Thank you, @jopursle for looking into this and the advice on the managed solutions!
The component is for Canvas app, I didn't try in a model-driven one.
I tried the following and can report:
On the possible reasons (confession time) - I did try to use <img> resource. It successfully compiled and deployed, but I could not import. I removed the resource (in the manifest and project), but it didn't fix the import issue as per this thread until I renamed the component.
@TechnoKitty That's interesting it would still be having issues afterwards. I'll see if I can get a local repro doing similar steps tomorrow.
Would it be possible to get the session id from a Canvas session hitting the import issue so I can see if there is any extra information on why this happened?
Session Id can be found under "File>Account>Session details"
I think I can reproduce and fix* the issue now, @jopursle
If I remove any resource from the Manifest which was declared there previously (I tried CSS), then I cannot import the component - it fails with the error. If I put the resource back, the component imports successfully!
*) with the <img> it seems stuck because it doesn't work one way, neither the other when once added :))
@TechnoKitty Thanks for the confirmation. I was able to find the error message at least that let me know that somewhere a Linq command was failing to find an element which narrowed it down a bit, but based on your info I think I know where it is happening.
It looks like import is still getting resources no longer directly referenced and then we fail on the check where all resources must be referenced by the manifest file.
I'll log a bug against myself to get this fixed. It shouldn't be that difficult to fix, but it will take a while to become available due to release schedules. For now, I'd advise not removing resources from a control (if using in Canvas) to get around this issue until a fix becomes available.
Thanks again @TechnoKitty for the info to track down the issue.
Another issue related to this you may want to look into, @jopursle, is when a component cannot be imported (for whatever reason) during an update of the existing app, the error is NOT displayed which makes it difficult to detect and troubleshoot.
That issue should already be fixed and checked in, it's just the train it's on isn't available yet. Hopefully it will be available next week, but no guarantees.
Check out the News & Announcements to learn more.
Did you know that you can visit the Power Query Forum in Power BI and now Power Apps
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.