cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft
Microsoft

Packaging multiple controls in single project

Looking for advice. Is it possible to package build and package multiple controls at the same time. Is there a way to have multiple controls in one .pcfproj? I dont want to have to duplicate the package.json and other files. I tried running the pcf-scripts build command with multiple controls and it appeared to build them ok, but the script just never completed after the build succeeded.

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps
Power Apps

Re: Packaging multiple controls in single project

Multiple controls in a pcfproj folder isn't really supported, especially when it attempts to bundle them in a solution.  The default way to do this is to have one control in the pcfproj and then have multiple references to different pcfproj files in the cdsproj file.

 

One thing you can do (although it's kind of hacky) is use symlinks to have shared node_modules directory, or use pnpm instead of npm to install.  Not sure if using symlinks to have a shared package.json file would work though.

View solution in original post

3 REPLIES 3
Power Apps
Power Apps

Re: Packaging multiple controls in single project

Multiple controls in a pcfproj folder isn't really supported, especially when it attempts to bundle them in a solution.  The default way to do this is to have one control in the pcfproj and then have multiple references to different pcfproj files in the cdsproj file.

 

One thing you can do (although it's kind of hacky) is use symlinks to have shared node_modules directory, or use pnpm instead of npm to install.  Not sure if using symlinks to have a shared package.json file would work though.

View solution in original post

bwouden
New Member

Re: Packaging multiple controls in single project

Do you have an example of how to add references to multiple control references in the cdsproj file?  I have several controls in their own projects, but I don't want to have to import then all separately into each CRM environment.

Power Apps
Power Apps

Re: Packaging multiple controls in single project

Hi @bwouden 

You can reference multiple controls in the cdsproj file by using the ProjectReference element.  There are a couple of ways you can do it depending on the directory structure.

If all the controls are relative to the solution in some way, you can use globbing:

  <ItemGroup>
    <ProjectReference Include="..\**\*.pcfproj" />
  </ItemGroup>

 

Or you can link to them directly:

  <ItemGroup>
    <ProjectReference Include="..\TestControl1\TestControl1.pcfproj" />
    <ProjectReference Include="..\TestControl2\TestControl2.pcfproj" />
  </ItemGroup>

 

Or a mixture of both. 

When you build the cdsproj file, it should build all the referenced pcfproj files and bundle them in a zip for you.

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Users online (9,107)