Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

msbuild fails due to invalid PCF component. Works in local test harness

When running "msbuild /t:build /restore" to package my PCF component, I recieve an error stating that the PCF project that I referenced using "pac solution add-reference" is not a valid component:



c:\pcfProj\.nuget\packages\microsoft.powerapps.msbuild.solution\1.5.5\build\Microsoft.PowerApps.MSBuild.Solution.targets(104,5): error : Project Reference with output path 'c:\pcfProj\Timeline\CRMTimelineMaster\CRMTimeline\out\controls\', is not a valid PowerApps Component Type [C:pcfProj\Solutions\Timeline\Timeline.cdsproj]

c:\pcfProj\.nuget\packages\microsoft.powerapps.msbuild.solution\1.5.5\build\Microsoft.PowerApps.MSBuild.Solution.targets(104,5): error : Cds component type not supported [C:\pcfProj\Solutions\Timeline\Timeline.cdsproj]



My project directory has the following structure:


│ ├───dist\
│ ├───bundle.js
│ └───ControlManifest.xml
└───BasicTimeline.pcfproj, package-lock.json, package.json, & tsconfig.json


I've tried changing the "outdir" value in pcfconfig.json to "./out/controls/BasicTimeline" rather than just "./out/controls", but this didn't work.


Moreover, the code used to implement the PCF component works correctly in a local test harness using "npm start".


Has anyone experienced this issue before and could offer troubleshooting suggestions?


@jwen25 - When you run "pac solution add-reference" you are actually adding a reference to your pcfproj file inside the cdsproj file on the solution folder. I have my folder setup like below



├── QR Code.pcfproj
├── QRCode
│   ├── ControlManifest.Input.xml
│   ├── QRCode.tsx
│   ├── generated
│   │   └── ManifestTypes.d.ts
│   └── index.ts
├── Solution
│   └── PCFQRCode
│       ├── Other
│       ├── PCFQRCode.cdsproj
│       ├── bin
│       └── obj
├── out
│   └── controls
│       └── QRCode
├── package-lock.json
├── package.json
├── pcfconfig.json
└── tsconfig.json



So, I run "pac solution add-reference -p ../../" from the Solution/PCFQRCode folder. Once I do this I can also verify by opening the cdsproj file and confirm that the reference is there.



Just check what the reference is in your cdsproj file. I had no issues in running msbuild, so I could not reproduce this issue. 

Frequent Visitor

Thanks @rajyraman. I was playing around with the "BasicTimeline.pcfproj" project file yesterday and found that changing the Microsoft.PowerApps.MSBuild.Pcf package reference version from "0.*" to "1.*" caused msbuild to run successfully and package my component into a zip file.


Originally, my pcfproj file had the following structure:

<PackageReference Include="Microsoft.PowerApps.MSBuild.Pcf" Version="0.*"/>

After I changed the version attribute to "1.*", msbuild ran successfully.


Thanks again for your help!

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (1,167)