Compiling 10.2B without the Assembly

Posted by KenWalsh on 13-May-2010 13:31

I am attempting to build a simple interface between our Progress application and Crystal 2008.

I have written the interface, and since I have Crystal installed it will compile on my machine, but I need it to compile on machines without the Crystal Assemblies.

I have tried defining the variable as a Progress.Lang.Object, and used DYNAMIC-CAST method to dynamically define it as a Crystal Object, but I cannot get it to run methods from the crystal object.

Can someone please tell me if there is a way to do this, or is the only answer to not ship that program to people without the Crystal assemblies?

Thanks,

Ken

All Replies

Posted by Peter Judge on 13-May-2010 14:56

I am attempting to build a simple interface between our Progress application and Crystal 2008.

I have written the interface, and since I have Crystal installed it will compile on my machine, but I need it to compile on machines without the Crystal Assemblies.

I have tried defining the variable as a Progress.Lang.Object, and used DYNAMIC-CAST method to dynamically define it as a Crystal Object, but I cannot get it to run methods from the crystal object.

You'll need the Crystal assemblies to run (and compile) calls to the Crystal methods.

Can someone please tell me if there is a way to do this, or is the only answer to not ship that program to people without the Crystal assemblies?

You'll need some form of build script that determines whether Crystal's installed, or, as you say, not ship the code. There are surely classes that allow you to query the .NET GAC to determine whether an assembly exists there; for local assemblies, you could either inspect the assemblies.xml file, or the folder referenced by -assemblies.  You'll probably need to parse the SESSION:STARTUP-PARAMETERS property for that location. I don't believe the ABL gives you easier access to that information at the moment (this might make a nice bug report enhancement request).

-- peter

Posted by Admin on 13-May-2010 15:43

You'll need some form of build script that determines whether Crystal's installed, or, as you say, not ship the code. There are surely classes that allow you to query the .NET GAC to determine whether an assembly exists there;

Well some company, located in Bedford, created such a function:

DEFINE VARIABLE oType AS System.Type NO-UNDO .

oType = Progress.Util.TypeHelper:GetType ("Infragistics.Win.UltraWinGrid.UltraGrid")

NO-ERROR .

MESSAGE "Is UltraGrid Assembly installed?" VALID-OBJECT (oType)

VIEW-AS ALERT-BOX .

Posted by Admin on 13-May-2010 15:53

I have written the interface, and since I have Crystal installed it will compile on my machine, but I need it to compile on machines without the Crystal Assemblies.

A single missing .NET assembly can break compilation of a large part of the application. That's the curse of strong typing.

My preferred workaround is to use a procedural wrapper or caller for those .NET classes that might be missing at one site. That's just a different kind of a factory.

One Form would run that procedure (including proper error handling) and that procedure would instantiate the potentially missing .NET assembly. The Form would not care at compile time if the Assembly is there or not because the RUN statement in the Form is not evaluated at compile time. The Form (maybe your main menu) will always compile and you'd have to deal with a STOP condition at runtime when the .p or .r of the procedure is not available.

Another way would be to build your own build scripts (a progress procedure). In the beginning you'd test if the Crystal assembly is available (see the Progress.Util.TypeHelper:GetType () sample). Then you'd generate an include file containing a

&GLOBAL-DEFINE CrystalAvailable YES

or

&GLOBAL-DEFINE CrystalAvailable NO

and include the include file in all classes that access crystal reports and use

&IF "{&CrystalAvailable}" = "YES" &THEN

...

&ENDIF

to surround code that accesses types from Crystal.

Posted by Peter Judge on 14-May-2010 06:43

Well some company, located in Bedford, created such a function:

>

You'll have to be more specific than that

But I completely forgot that one ... and don't forget the NO-ERROR either (that bit me too, although on the Progress.Lang.Class type).

-- peter

Posted by jquerijero on 19-May-2010 11:27

The best approach is to just redistribute Crystal Reports Run-Time Redistributable assemblies. It's free and should allow your user to enjoy your reports :).

https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm

This thread is closed