Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
bmidhun
Frequent Visitor

Request for Guidance on Programmatically Generating PBIP Folder Structure Using C# or PowerShell

Hi Team

 

We would like to request support or guidance on replicating the exact folder structure of a PBIP file programmatically, as outlined below:

 

Report
  .Report/.pbi
  .Report/StaticResources
  All platform files, including definition.pbir and report.json

SemanticModel
  .pbi
  definition

 

Our goal is to understand whether it is feasible to dynamically generate this complete PBIP folder structure using C# or PowerShell.

 

Any advice, suggestions, or relevant references from the community would be greatly appreciated.

1 ACCEPTED SOLUTION
v-kathullac
Community Support
Community Support

Hi @bmidhun  ,

 

we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

Regards,

Chaithanya.

View solution in original post

8 REPLIES 8
v-kathullac
Community Support
Community Support

Hi @bmidhun  ,

 

we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

Regards,

Chaithanya.

v-kathullac
Community Support
Community Support

Hi @bmidhun  ,

 

we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

Regards,

Chaithanya.

bmidhun
Frequent Visitor

Kindly let me know if anyone have any idea on the above topic

Hi @bmidhun ,

Thank you for reaching out to Microsoft Fabric Community Forum.

can you try the below code in powershell .

# Define the root directory for the PBIP project
$rootPath = "C:\PowerBIProject"

# Create the main folders
$reportPath = Join-Path $rootPath "Report"
$semanticModelPath = Join-Path $rootPath "SemanticModel"
$reportFolderPath = Join-Path $reportPath ".Report"
$staticResourcesPath = Join-Path $reportPath "StaticResources"

# Create the directories
New-Item -ItemType Directory -Path $reportFolderPath -Force
New-Item -ItemType Directory -Path $staticResourcesPath -Force
New-Item -ItemType Directory -Path $semanticModelPath -Force

# Create sample .pbi files and other platform files
New-Item -ItemType File -Path (Join-Path $reportFolderPath ".pbi") -Force
New-Item -ItemType File -Path (Join-Path $staticResourcesPath "placeholder.txt") -Force
New-Item -ItemType File -Path (Join-Path $reportPath "definition.pbir") -Force
New-Item -ItemType File -Path (Join-Path $reportPath "report.json") -Force
New-Item -ItemType File -Path (Join-Path $semanticModelPath ".pbi") -Force
New-Item -ItemType File -Path (Join-Path $semanticModelPath "definition") -Force

# Output success message
Write-Host "PBIP folder structure has been created at $rootPath"

Regards,

Chaithanya.

 

 

bmidhun
Frequent Visitor

Thanks @MFelix @johnbasha33 @Bhavnish  for your reply. But as per my requirement including folder structure i need to generate all the necessary files which completes the PowerBI Project file (PBIP).

Kindly let me know if there is any code or link which can help me on the same.

johnbasha33
Super User
Super User

@bmidhun 

Here’s a full PowerShell script to generate this folder structure:

# Set the root folder where you want to create the PBIP structure
$rootPath = "C:\PBIPSample"

# Define all the folder paths
$folders = @(
"$rootPath\Report\.pbi",
"$rootPath\Report\StaticResources",
"$rootPath\SemanticModel\.pbi"
)

# Define the file paths
$files = @(
"$rootPath\Report\definition.pbir",
"$rootPath\Report\report.json",
"$rootPath\SemanticModel\definition"
)

# Create all folders
foreach ($folder in $folders) {
if (!(Test-Path -Path $folder)) {
New-Item -ItemType Directory -Path $folder -Force
}
}

# Create empty files
foreach ($file in $files) {
if (!(Test-Path -Path $file)) {
New-Item -ItemType File -Path $file -Force
}
}

Write-Host "PBIP structure created successfully at $rootPath!"

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!



Bhavnish
Frequent Visitor

goes outside the scope of power Bi

Staying within the scope of power Bi , if you are trying to replicate the structure for multiple members just for connection purpose , using a PBIDS format would allow you to do that

 

As per copilot you can use the following commands :

1. Using PowerShell
PowerShell's directory and file management capabilities make it a good choice for this task. Here's a basic outline of the script:

# Define the root folder
$rootPath = "C:\PBIP_FolderStructure"

# Create Report folder structure
New-Item -ItemType Directory -Path "$rootPath\Report\.Report"
New-Item -ItemType Directory -Path "$rootPath\Report\.Report\StaticResources"
New-Item -ItemType File -Path "$rootPath\Report\.Report\.pbi"
New-Item -ItemType File -Path "$rootPath\Report\definition.pbir"
New-Item -ItemType File -Path "$rootPath\Report\report.json"

# Create SemanticModel folder structure
New-Item -ItemType Directory -Path "$rootPath\SemanticModel"
New-Item -ItemType File -Path "$rootPath\SemanticModel\.pbi"
New-Item -ItemType File -Path "$rootPath\SemanticModel\definition"

 

2. Using C#
C# gives you more flexibility and allows integration into larger applications. Below is an example:

using System;
using System.IO;

class Program
{
static void Main()
{
string rootPath = @"C:\PBIP_FolderStructure";

// Create Report folder structure
Directory.CreateDirectory(Path.Combine(rootPath, @"Report\.Report\StaticResources"));
File.Create(Path.Combine(rootPath, @"Report\.Report\.pbi")).Dispose();
File.Create(Path.Combine(rootPath, @"Report\definition.pbir")).Dispose();
File.Create(Path.Combine(rootPath, @"Report\report.json")).Dispose();

// Create SemanticModel folder structure
Directory.CreateDirectory(Path.Combine(rootPath, "SemanticModel"));
File.Create(Path.Combine(rootPath, @"SemanticModel\.pbi")).Dispose();
File.Create(Path.Combine(rootPath, "SemanticModel/definition")).Dispose();

Console.WriteLine("PBIP folder structure created successfully!");
}
}


Compile and run this C# program, and it will generate the desired folder structure and files.

MFelix
Super User
Super User

Hi @bmidhun

 

The full definition can be get at the MSFT documentation:

 

https://learn.microsoft.com/en-us/power-bi/developer/projects/projects-dataset

https://learn.microsoft.com/en-us/power-bi/developer/projects/projects-report?tabs=desktop

 

Be aware that for the Dataset there are two different schemas semantic model and TMDL.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors