locked
Passing Built-in Collections into Custom Assemblies RRS feed

  • Question

  • User752060696 posted

    Hi All,

    My first post! I've inherited a number of projects including a large number of reports. I'm in the process of rewriting many of these reports to use shared data sources, data sets and custom code. Previously all code and data sets were embedded in the reports, duplicating a lot of the work and causing maintenance nightmares. For this task I had planned to use Visual Studio 2013, to introduce some level of organisation and source control as well as taking advantage of the preview and deployment features. I thought I would break these reports up into logical solutions and projects and create custom assemblies to provide access to shared code.

    The problem I am having is that some of the code will need access to some of the built-in report collections (Parameters, Fields etc...). I'm fairly new to writing managed code, coming from a scripting background, so I am having some trouble understanding how to setup the relevant references and where to get these references. I've read this msdn article regarding including a reference to ReportObjectModel to access these objects but I'm unsure how to proceed.

    Do I need a reference to Microsoft.ReportingServices.ProcessingObjectModel.dll (local) for Visual Studio to preview the report and then a reference to Microsoft.ReportViewer.ProcessingObjectModel.dll (server) on my report server? Do these need referencing twice in this case? Also where are the best places to find these assemblies? Should I use the ones in the GAC, how can I be sure they are available on my report server, or should I  copy to the local bin directory? If so how should I reference and deploy then?

    Perhaps I need a tutorial regarding the deployment of referenced assemblies! Would anyone have a link to any good resources regarding this subject. I think that because I'm not used to the nomenclature used in this kind of development I'm not searching for the correct terms to resolve my problem so any help would be greatly appreciated.

    Thanks

    Andy

    Tuesday, June 23, 2015 4:02 AM

All replies

  • User1711366110 posted

    Do I need a reference to Microsoft.ReportingServices.ProcessingObjectModel.dll (local) for Visual Studio to preview the report and then a reference to Microsoft.ReportViewer.ProcessingObjectModel.dll (server) on my report server? Do these need referencing twice in this case? Also where are the best places to find these assemblies? Should I use the ones in the GAC, how can I be sure they are available on my report server, or should I  copy to the local bin directory? If so how should I reference and deploy then?

        As per this case, To deploy a custom assembly in SQL Server Reporting Services, place the assembly in the application folders of both Report Designer and the report server. By default, custom assemblies are granted Execution permission in Reporting Services. To grant custom assemblies privileges beyond Execute permission, you will need to edit the rssrvpolicy.config configuration file for the report server and the rspreviewpolicy.config configuration file for the Report Designer preview window. Alternatively, you can install your custom assembly in the global assembly cache (GAC).

    for your reference, check the following links :
    1. Click here to refer about SQL Server Reporting Services Custom Code Assemblies.

    2. Click here to refer about How to use custom assemblies or embedded code in Reporting Services.

    3. Click here to refer about Deploying a Custom Assembly.

    Wednesday, June 24, 2015 1:36 AM
  • User752060696 posted

    Thanks for the information Edwin. Do you have any further information on using the built in collections in reports? Which of the dlls should I reference? and where should I reference them from?

    Thanks again.

    Wednesday, June 24, 2015 1:31 PM
  • User1711366110 posted

    Do you have any further information on using the built in collections in reports? Which of the dlls should I reference? and where should I reference them from?
     
          For add those custom assemblies, goto  Visual Studio in the properties of the report, on the 'References' tab add the details for the assembly that contains the managed code. This code can be called from expressions within reports using the instance name that is specified.

     Note: Refer the steps about "Adding a reference to the custom assembly in Reporting Services" from the second link of my above reply.

    Thursday, June 25, 2015 2:22 AM
  • User752060696 posted

    Hi Edwin

    I am able to follow the documentation for adding custom assemblies without problems but it is when I am referencing existing Microsoft dlls, such as the ones that provide access to the report Parameter and Fields objects, that is causing me the problems. See the following code...

    Imports Microsoft.ReportingServices.ReportProcessing.ReportObjectModel
    
    Public Class SSRS
    
        Public Shared Function IsRowHidden(ByRef objParam As Parameter, ByRef objFields As Fields) As Boolean
    
            Dim blnHidden As Boolean = False
            Dim i As Integer
    
            For i = 0 To objParam.Count - 1
    
                ...
    
            Next
    
            Return blnHidden
    
        End Function
    
    End Class

    Including the reference is fine but when I want to perform complex logic, for example to determine if a column or row should be hidden, I want to iterate through the Parameter and Fields collections. This works fine with inline code in the report but I want to abstract this code to be reused else where. These particular objects are in different places depending on the environment, visual studio or on the report server, so I really trying to find out how to include these assemblies in both my development and production environments,

    Sorry if I did not explain my situation clear enough and thanks for all the help you have already given.

    Thursday, June 25, 2015 4:17 AM
  • User752060696 posted

    Anyone have any ideas on this one? It's really annoying not to be able to write complex logic to be able to operate on the Parameter and Fields collections!

    An error occurred during local report processing.
    
    The definition of the report '###' is invalid.
    
    The Visibility.Hidden expression for the tablix 'Tablix1' contains an error: [BC30652] Reference required to assembly 'Microsoft.Report.Viewer.ProcessingObjectModel, Version=12.0.0.0, Culture=neutral, ...' containing the type 'Microsoft.ReportingServices.ReportProcessing.ReportObject.Model.Parameter'. Add one to your project.

    I've insert the reference to the 'Microsoft.ReportViewer.ProcessingObjectModel' but this is still coming up!

    Friday, July 3, 2015 10:44 AM
  • User1711366110 posted

    I've insert the reference to the 'Microsoft.ReportViewer.ProcessingObjectModel' but this is still coming up!

        According to this case, you can try to do the following steps :

    1.In Windows, click the Start button, click Run, then type regedit to open the Registry Editor.

    2.Select the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\AssemblyFolders

    3.On the Edit menu, point to New, then click Key.

    4.Enter a name for the key (for example, MyAssemblies).

    5.Select the (Default) value for the key that you just added.

    6.On the Edit menu, choose Modify.

    7.In the Edit String dialog box, select the Value data field and enter the full path to the folder where your assemblies are located.

     Note   Only the specified folder will be searched each time the Add References dialog box is opened; subfolders will not be searched. You must add a separate key for each subdirectory to be searched.

    Monday, July 6, 2015 5:55 AM