Newbie - How to access my own .Net DLL in the OE 10.2b

Posted by christian.bryan@capita.co.uk on 06-Dec-2012 08:25

Hi

I am looking just to simply access my own C# .net DLL from the ABL in OE10.2b.

I have the following C# .net code which i build in VS 2008

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace CSS.OpenHousing.SampleAdditionLibrary

{

    public class Addition

    {    

        public double AddUp(double number1, double number2)

        {

            return number1 + number2;

        }

    }

}

I have added the resultant DLL into the assemblies.xml file via Proasmref.
I have the following ABL code
/*------------------------------------------------------------------------
    File        : example
    Purpose     :
    Syntax      :
    Description :
    Author(s)   : Christian Bryan
    Created     : 06/12/2012
    Notes       :
  ----------------------------------------------------------------------*/
USING CSSOHSampleAdditionLibrary.* FROM ASSEMBLY.
DEFINE VARIABLE clAddition AS Addition.
   
clAddition = NEW Addition().
But this gives an error (5638) saying it does not recognise the class Addition.
What am i doing wrong?
[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/Class1.cs.zip:550:0]

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/CSSOHSampleAdditionLibrary.dll.zip:550:0]

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/Example_5F00_dotnet_5F00_dll_5F00_integration.p.zip:550:0]

All Replies

Posted by Admin on 06-Dec-2012 08:32

Try

USING CSS.OpenHousing.SampleAdditionLibrary.* FROM ASSEMBLY .

Looks like you are missing the periods in your sample code.

Posted by Peter Judge on 06-Dec-2012 08:37

You also need to make sure that the assembly is either in the GAC or the directory refererred to by the -assmeblies parameter (same place as the assemblies.xml file).

It may be just cut & paste, but the ABL USING looks incorrect

USING CSSOHSampleAdditionLibrary.* FROM ASSEMBLY.

>

Should that not be

USING CSS.OpenHousing.SampleAdditionLibrary.* FROM ASSEMBLY.

-- peter

Posted by christian.bryan@capita.co.uk on 06-Dec-2012 09:52

OKay - Thanks for help.

Added the DLL to the GAC via gacutil and added it to the assemblies.xml files as well and it compiles and runs now.

If you were deploying on-site would i need the assemblies.xml in the propath and the DLL in the GAC?

Thanks

Posted by Admin on 06-Dec-2012 09:57

If you were deploying on-site would i need the assemblies.xml in the propath and the DLL in the GAC?

 

Check the documentation for the -assemblies parameter.

The assemblies.xml file need to be in the working directory of the directory referenced by the -assemblies parameter.

Your custom .dll needs to be in the GAC or in the directory referenced by the -assemblies parameter.

Posted by Peter Judge on 06-Dec-2012 09:57

Added the DLL to the GAC via gacutil and added it to the assemblies.xml

files as well and it compiles and runs now.

Nice!

If you were deploying on-site would i need the assemblies.xml in the

propath and the DLL in the GAC?

Always in assemblies.xml.

Either in the GAC or in the same directory as assemblies.xml. Others will have guidance on which is the best approach.

-- peter

Posted by christian.bryan@capita.co.uk on 06-Dec-2012 10:19

Just out of interest i tried the same approach on VS2010, basically the same Class but with different namespace and assembly name.

This is targeted at .NET 4.0.

When i add this to the GAC i cannot see it via proasmref.

Is it that .NET 4.0 uses a different GAC that proasmref can't see?

Thanks

Posted by Admin on 06-Dec-2012 10:22

Is it that .NET 4.0 uses a different GAC that proasmref can't see?

 

OpenEdge 10.2B has support for .NET 3.x only.

OpenEdge 11 adds support for .NET 4.0

Posted by christian.bryan@capita.co.uk on 06-Dec-2012 10:26

You guys are awesome

Posted by ge1971 on 06-Dec-2012 10:32

We've just put the .DLL files & assemblies.xml in a myassemblies sub-directory which exists under the main app working directory.

Then added a  -assemblies myassemblies startup parameter.

So far we've had no GAC problems deploying DLLs using the WebClient software to client PCs using this method.

This thread is closed