CrystalReports: getting engine version

When working on the new web-site which uses CrystalReports engine to display some reports, it is useful to know what version is used.

Yes, we usually know what version of engine we have on development machine because of the level of the control we have. With production environment, it may be not so obvious because it can be deployed by others. And at some point something may happen to the machine and environment was restored from the backup.

In all cases considered, to know what Run-time do we have at the moment without actually go and look at assemblies, may be very useful and quick check to determine the problem.

Since we are using .Net, it can be done easily by including version info into our ASP.Net page.
Lets assume we have lbCrystalVersion Label control on the page, then in the Page_Load() the following code can be added to populate information needed:

lbCrystalVersion.Text = "Crystal Reports: " + typeof(CrystalDecisions.CrystalReports.Engine.ReportObject).Assembly.GetName().Version.ToString();

As you can see, I am using ReportObject to determine current version.

In case of CrystalReports 2008 version displayed would be 12.0.2000.0

This entry was posted in Crystal Reports. Bookmark the permalink.

Leave a Reply