Pages

Men

rh

4/28/2012

Extending the SSRS with Custom Assemblies

Instead of adding the custom code to a report directly, you can create a custom assembly and reference it from multiple reports. Thus Custom Assemblies provide even more reusability then embedded code.

When you write Custom Assembly, you are not limited to write the code in Visual basic; you can also write the code in  .Net languages, such as  Visual C#.

Before going to start using code from a Custom Assembly in your report, you have to deploy the assembly. To deploy Custom Assembly, copy the assembly file to application folders of your SSRS server and the Report Designer. You can also install Custom Assembly in GAC.

Custom Assemblies are granted execution permission by default; this allows code execution in the scope of the Report itself. If your code  needs resources outside that scope for example, if the code reads the file from the File System or a value from the registry- you must grant the assembly additional privileges.
To grant the additional permissions, you need to edit the  rssrvpolicy.config configuration file for the report server and the repreview  policy.config configuration file for the report designer.

What are the General Steps to be followed for deploying a Custom Assembly in SSRS?
  • Copy your Custom Assembly to the report server bin folder and the Report Designer Folder. The Default location for the bin folder for the Report Server is C:\Program Files\Microsoft SQL Server\ MSRS10.MSSQLSERVER\Reporting Services\Report Server\bin\. The Default location of the Report Designer folder is C:\Program Files\Microsoft Visual Studio 9.0\Common7\ IDE\Private Assemblies\
  • If you need to add additional privileges beyond the default Execution permission, you nees to change the two Configuration files, such as   rssrvpolicy.config configuration and repreview  policy.config. The default location of rssrvpolicy.config is C:\Program Files\Microsoft SQL Server\ MSRS10.MSSQLSERVER\Reporting Services\Report Server\. The default location for the repreview  policy.config is C:\ Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Private Assemblies\ 
  • Add a code for your custom assembly. Custom Assemblies are controlled through .NET Code Access Security.
How to add a reference to an assembly in a report ?
following steps needed to be follow , if you want to add a reference to assembly in a report.
  • In the Report Designer, Click the Design Tab.
  • From the Report Menu, Select Report Properties
  • Click the Reference Tab.
  • In Add or Remove Assemblies Section,Click Add, and then click the ellipsis (....) button to browse the assembly. Select the Assembly and then click OK.
  • In the Add or Remove Classes, click Add, type the name of the class, and then provide an instance name to use the report. If you use static members  only,  use only Add or Remove Assemblies section.



No comments :

Post a Comment