cancel
Showing results for 
Search instead for 
Did you mean: 

version of SAP Crystal Reports for Visual Studio installed

BBGMeccanica
Newcomer
0 Kudos

How can I find out which version of SAP Crystal Report for Visual Studio I have installed on my computer?

Thanks a lot

Fabrizio

View Entire Topic
DonWilliams
Active Contributor
0 Kudos

Look in Programs and Features you will see CR for VS, scroll to the right and it will give you the version.

To do that in code you can look in the same Registry locations.

Depending on the version I use this code, location of the registry changed in newer version:

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 Cortez - managed reporting )
        if (fileVersionInfo.FileVersion.Substring(0, 2) == "13")
        {
            btnRasOpen.Enabled = false;
        }
        CRVer = fileVersionInfo.FileVersion.Substring(0, 2);
        //return;

        // check if debug mode
        var assembly = Assembly.LoadFrom(@"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\v4.0_13.0.4000.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ClientDoc.dll");
        object[] attribs = assembly.GetCustomAttributes(typeof(DebuggableAttribute), false);

        // If the 'DebuggableAttribute' is not found then it is definitely an OPTIMIZED build
        if (attribs.Length > 0)
        {
            // Just because the 'DebuggableAttribute' is found doesn't necessarily mean
            // it's a DEBUG build; we have to check the JIT Optimization flag
            // i.e. it could have the "generate PDB" checked but have JIT Optimization enabled
            DebuggableAttribute debuggableAttribute = attribs[0] as DebuggableAttribute;
            if (debuggableAttribute != null)
            {
                bool HasDebuggableAttribute = true;
                var IsJITOptimized = !debuggableAttribute.IsJITOptimizerDisabled;
                var BuildType = debuggableAttribute.IsJITOptimizerDisabled ? "Debug" : "Release";

                // check for Debug Output "full" or "pdb-only"
                var DebugOutput = (debuggableAttribute.DebuggingFlags &
                                DebuggableAttribute.DebuggingModes.Default) !=
                                DebuggableAttribute.DebuggingModes.None
                                ? "Full" : "pdb-only";
            }
        }
        else
        {
            var IsJITOptimized = true;
            var BuildType = "Release";
        }
    }
}

And I use this to check the platform:

// show if app is using x86 or x64 runttime
if (Environment.Is64BitProcess)
    txtRuntimeVersion.Text = "x64: ";
else
    txtRuntimeVersion.Text = "x32: ";