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. 

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

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (1,852)