In the first part of this series I gave an introduction to setup, test and deployment of PCF components. And the plan was that the next part should be about the actual coding of a PCF component.
But after talking with some of my coworkers I realised that we all came across a lot of the same problems/errors, and as a newbie it can be hard to know where to start when looking for a solution. Therefore I decided that this second part should be about common problems/errors that you can come accross when developing a PCF component. I will update this post as I encounter more problems/errors (as I’m sure I will).
Problem: When you add a new property to your manifest file the TypeScript-type will not be generatet until you run
npm run build. So if you try using the property in your code before that you will get the error “Property ‘propertyname’ does not exist on IInputs.
npm run build
Problem: You try to run pac pcf push to test your solution, and you get the Error: Building temporary solution failed.
Possible solution 1:
The first thing I do is to do a npm run build. And in most cases there is some small compilation error in my code, like ” expecting a ; ..” , and after fixing these errors I can run pac pcf push again with no errors.
Possible solution 2:
If the npm build does not return any errors I take a look in the obj\build.log file.
One error that showed up was problems with loading nuget packages.
Since this error showed up right after I had cloned and setup a .NET project in Visual Studio I figured it must be that msbuild (which is used by pac pcf push) tries to use all the packages that are referenced in “Package source”.
And sure enough when I went into VS2019 and unselected the private packages I was again able to run pac pcf push without errors. To find these settings go in Visual Studio –> Tools –> Nuget Package manager –> Package Manager settings. And select “Package sources” as shown in the image below.
Unselect the packages that require additional login.
I hope you found this article useful. If you have any feedback or questions please let me know in the comments below. 🙂
Thank you for reading, and happy coding!