Possible to support multiple versions of report viewer control in a single application? RRS feed

  • Question

  • We have a single windows forms client application which uses the ReportViewer control (from Microsoft.ReportViewer.WinForms.dll). Originally, all of our clients used only SQL Server 2005, but now we have a mix of 2005, 2008, 2008 R2 etc. We therefore need our application to be able to support different reporting server versions because none of the ReportViewer controls work 100% successfully across all versions.

    What I would like to know is, is there some way to dynamically use a different version of the ReportViewer control at runtime dependent upon some sort of switch?

    I have so far tried to create a seperate user control for each version of the ReportViewer, but this idea failed because I was unable to add a reference to each of the different versions of Microsoft.ReportViewer.WinForms.dll as they all have the same filename. I tried renaming each dll eg Microsoft.ReportViewer.WinForms.8.dll, Microsoft.ReportViewer.WinForms.9.dll, Microsoft.ReportViewer.WinForms.10.dll etc but this did not help as my project would not compile.

    Any ideas?

    Thanks in advance for any suggestions.

    Thursday, August 18, 2011 2:39 PM

All replies

  • Further to my original post, if any Microsoft developers are reading, would it be possible for me to get hold of all the various versions of the report viewers components compiled into version-specific named dlls, eg Microsoft.ReportViewer.WinForms.8.0.dll, Microsoft.ReportViewer.WinForms.9.0.dll, Microsoft.ReportViewer.WinForms.10.0.dll etc so that I could achieve my original goal of dynamically creating the required version of the report viewer in our application at runtime?
    Tuesday, August 23, 2011 12:37 PM
  • I find myself in the exact same situation.  I have to find a solution, or make some very difficult descisions.  My 2005 SSRS user base is considerable, yet I'm also seeing demand for 2008 RDL schema support, I can't support both scenarios with either version of the ReportViewer control.  The story here is complcated and difficult to explain to my customers.  Anyone with a suggestion for working around this, please let me know.

    Thanks in advance.

    • Edited by adurling Tuesday, January 24, 2012 9:12 PM
    Tuesday, January 24, 2012 9:11 PM
  • I have solved this problem for our application.  The key to achieving this is being able to reference two versions of the same assembly from one consuming assembly.  I found most of the information I needed here:

    Given that the classes in each version of the ReportViewer retain broadly the same behaviours, it is possible to then wrap each version of the ReportViewer in version agnostic classes and interfaces, such that the bulk of your code remains unchanged.  I now have a control in my application on which I set a property stating what version of the ReportViewer I wish to use.  Our application supports both server and locally rendered reports, so the rule is that I use v9 (VS2008) when connecting to an SSRS 2005 report server, and v10 (VS2010) for all other scenarios.  Looking at the version of ReportViewer that ships with VS11 RC0, it should be possible to extend this control to support that too.

    I've only gone so far as to service the specific needs of my application, so I don't have a generic solution covering all of the functionality of the ReportViewer control.  It would be great if someone with more time than me could do that!

    If you are using the ReportViewer redistributable to install the ReportViewer control to the end user, then this technique should just work as all the assemblies you need to reference will be installed in the GAC. If want more control, you can use the dependantAssembly element in the runtime configuration, as explained here (I haven't tried this):

    I hope this helps anyone searching to solve this in the future.

    • Proposed as answer by adurling Friday, January 27, 2012 12:34 PM
    Friday, January 27, 2012 12:33 PM
  • Hi Adam,

    I am facing the same issue with a report viewer requirement. Did you create a separate project and wrap the reportViewer control or did you create a separate project that basically wraps the reportViewer class and load the reportViewer dll at runtime? I'm stumbling on this and really need to see some examples. Can you provide your solution or any of the wrapping portion?


    • Edited by Prost98 Tuesday, August 13, 2013 1:45 AM
    Tuesday, August 13, 2013 1:44 AM
  • Hi John, 

    I have a query which is not relevant to this particular thread.

    You raised a question in this Forum, please check the following URL

    I have got a same issue and would appreciate if you can share your experience of how you managed to
    resolve the reported issue. Unfortunately that particular thread has been closed and I could not raise my question there.

    We are having a same issue where first call to WCF takes more than 15 seconds. We can confirm that
    <FILE>.XMLSerializers.dll gets load in the memory but when I make the first call I also get the same error
    Pre-generated serializer '<NAME>.XmlSerializers' has expired 

    Any help to fix this issue would be appreciated. Thanks.

    Muhammad Iqbal

    Friday, February 19, 2016 12:25 PM