Deploying a Custom Assembly
You need to place custom assemblies in the application folders of Report Designer and the report server. Additionally, to use custom assemblies you need to edit the configuration file rssrvpolicy.config for the report server and the configuration file rspreviewpolicy.config for the Report Designer preview window. By default, custom assemblies are granted Execution permission in Reporting Services.
Note There are two preview modes for Report Designer: the preview tab and the pop-up preview window that is launched when your report project is started in DebugLocal mode. The preview tab executes all report expressions using the FullTrust permission set and does not apply security policy settings. The pop-up preview window is meant to simulate the report server functionality and therefore has a policy configuration file that you or an administrator must modify to use custom assemblies in Report Designer. This pop-up preview also locks the custom assembly. Therefore, you need to close the preview window in order to modify or update your custom assembly code.
To deploy a custom assembly
- Copy your custom assembly from your build location to the report server bin folder or the Report Designer folder. The default location of the bin folder for the report server is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin. The default location of the Report Designer is C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer.
- Open the appropriate configuration file. The default location of rssrvpolicy.config is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer. The default location of rspreviewpolicy.config is C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer.
- Add a code group for your custom assembly if you need to increase code permissions beyond the default execution permissions. For more information, see Understanding Code Access Security in Reporting Services.
Updating Custom Assemblies
At some point, you may need to update a version of a custom assembly that is currently being referenced by several published reports. If that assembly already exists in the bin directory of the report server or Report Designer and the version number of the assembly is incremented or changed in some way, the currently published reports will no longer work properly. You will need to update the version of the assembly that is referenced in the CodeModules element of the report definition and republish the reports.
If you know that you will frequently update a custom assembly and your currently published reports need to reference the new assembly, you may want to consider using the same version number across all updates of a particular assembly. If you do not need your currently published reports to reference the new version of the assembly, you can deploy your custom assembly to the Global Assembly Cache. The Global Assembly Cache can maintain multiple versions of the same assembly, so that your current reports can reference the previous version of your assembly and your newly published reports can reference the updated assembly. Yet another approach would be to set the binding redirect of the report server to force a redirect of all requests for the old assembly to the new assembly. You would need to modify the report server Web.config file and the report server ReportService.exe.config file. The entry might look like the following:
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="myAssembly" publicKeyToken="32ab4ba45e0a69a1" culture="neutral" /> <bindingRedirect oldVersion="22.214.171.124" newVersion="126.96.36.199"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>