2003551 - How to Programatically get the version of Crystal Reports for .NET runtime version

SAP Knowledge Base Article - Public

2003551 - How to Programatically get the version of Crystal Reports for .NET runtime version

Symptom

Not sure about what version your application is loading or supports or requires?

One way to do this is as follows....

Environment

  • Visual Studio 2010, 2012 and 2013 and earlier version but not tested
  • Crystal Reports for Visual Studio .NET

Resolution

Add the following to the form Main:

string CRVer;

public frmMain()
{
       //
       // Required for Windows Form Designer support
       //
       InitializeComponent();


    foreach (Assembly MyVerison in AppDomain.CurrentDomain.GetAssemblies())
    {
        if (MyVerison.FullName.Substring(0, 38) == "CrystalDecisions.CrystalReports.Engine")
       {
            //File:             C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll
            //InternalName:     Crystal Reports
            //OriginalFilename:
            //FileVersion:      13.0.9.1312
            //FileDescription:  Crystal Reports
            //Product:          SBOP Crystal Reports
            //ProductVersion:   13.0.9.1312
            //Debug:            False
            //Patched:          False
            //PreRelease:       False
            //PrivateBuild:     False
            //SpecialBuild:     False
            //Language:         English (United States)

            System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(MyVerison.Location);
            txtRuntimeVersion.Text += fileVersionInfo.FileVersion.ToString();
            // check if CrsytalDecisions.Enterprise dll's can be loaded ( Anything but version 13 - managed reporting )
            if (fileVersionInfo.FileVersion.Substring(0, 2) == "13")
            {
                btnRasOpen.Enabled = false;
            }
            CRVer = fileVersionInfo.FileVersion.Substring(0, 2);
            return;
        }
    }

       //
       // TODO: Add any constructor code after InitializeComponent call
       //
}

The above code also checks to see if the runtime available also supports connectivity to CRS, CRSE or BOE/BI 4.0/4.1

Note: Crystal Reports for Visual Studio version 13 Runtime is the only current version that does not support connecting to Business Objects Enterprise ( BI 4.0 or 4.1 ) also known as Managed Reporting.

CR for VS is unmanaged reporting only ( loading report files from the local hard drive).

Keywords

KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2005 ; SAP Crystal Reports, version for Visual Studio .NET 2008 ; SAP Crystal Reports, version for Visual Studio .NET 9.1