Subreport in a Sub Folder – working in Visual Studio and SSRS

Subreports provide a great way to re-use SSRS content, however the implementation is a bit clumsy:

  • SSRS 2016 doesn’t let you effectively hide reports (only folders)
  • Visual Studio doesn’t let you have folders for SSRS projects (despite an 8 year old connect request with 290 up votes)
  • Folders sort of work in Report Builder, but there’s no version control

My design is for a user facing report with embedded parts that the user can’t see. This approach works in both Visual Studio and SSRS, and minimises maintenance.

In SSDT, link to the full path of the Subreport

This will work in SSRS once the Report is published, and the Subreport is published to ‘/Sales/ReportParts/’, however, we’ve broken the master report in Visual Studio

Note the path referred to in the error – it’s ‘your project folder’ + ‘\bin\Debug’ + ‘your subreport path’ + ‘your subreport’.

The challenge here is Visual Studio creates this content in \bin\Debug, and looks for it in \bin\Debug\Sales\ReportParts.

We could create this path and copy content into it, but this would be a maintenance headache as we have to copy the subreport, data sources, and any shared data sets, and need to re-copy it when any of these change.

Enter the Symbolic Link

To get around this I’ve created a symbolic link to trick Visual Studio into thinking the content is at this path, when it’s really just a pointer to the live content in ‘\bin\Debug’.

Here’s a guide on creating symbolic links in Windows, and here are the steps I ran in a command prompt (as adminsitrator) to create a link to ‘\Sales\ReportParts’:

cd /d "C:\Users\andrew.mosey.****\Documents\Repo\****\****\Reports\bin\Debug"

mkdir Sales

cd Sales

mklink ReportParts "C:\Users\andrew.mosey.****\Documents\Repo\****\****\Reports\bin\Debug"

1 Comment

  1. Ahmed says:

    Hey Andrew,

    Your workaround has been helpfull. I was wondering if you have a workaround for a subreport within a subreport. For example i have a collective main subreport(MainSubreport) that consists of 2 subreports(Subreport1 & Subreport2) that i re-use in other reports. If i use the method described above the MainSubreport is found but Subreport1 & Subreport2 gets the error that it can not be found in \bin\Release.

Leave a Comment