In almost every Reporting Services class I teach, I get basically same questions. One of the most popular questions is how do I call a method in a custom assembly from my report. Here are step By step, instructions to do this.
1. Using Visual Studio Create a new Class Library(VB or C#) I am going to name my Project SSRSAssembly
2. Rename your Class1.VB or Class1.CS to ComplexCalculations, presumably you would have your re-usable methods in this class
3. For next step, please use your imagination, pretend the following function has a few lines of code with loops possible calls to other assemblies and does some complex calculations (instead of just returning the square value of the parameter being sent to it.
(a) Add the following Method to your Class
Public Function SquareMe(ByVal i As Integer) As Integer
Return i ^ 2
public int SquareMe(int i)
return Math.Pow(i, 2);
4. Build Your project .
5. Open your Report project.
(1) Access your report properties from the Reports menu option
(2) Click on the reference tab and add a reference to your assembly by browsing to it.
(3) Define the class name ( in my example I called my class ComplexCalculations)
(4) Provide an Instance name.
6. In a textbox within your dataregion where you want to display the result of your call, enter:
7. Copy your Custom dll to Report Server bin folder (default location is C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin)
8. Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin.
9. After the last <CodeGroup .. add
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="SSRSAssembly" Description="reportHelperLib. ">
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\SSRSAssembly.dll"
10. Note you might have to change the Name and the URL.