Use Custom DLLs into Progress

Viewed 34

I'm having some issues while loading my custom DLL to OpenEdge Enviroment.

I've already copied my DLL to an PROPATH value and imported the DLL inside ProAsmRef.exe (The DLL is in the same folder as ProAsmRef and assemblies.xml)

The problem is, when I try to load my custom file inside a procedure, it sends me this current error:

**Unknown table name PCControl. (200)

I've already imported the DLL on my definition block with:

USING PCControl.*.

My DLL depends on another DLL (System.DirectoryServices.dll) but is already on assemblies.xml.

I can't figure it out why PCControl isn't importing, because I already have another two DLL's and they are working just fine...

Thanks for the help!

My DLL Code:

using System;
using System.DirectoryServices;
using System.Runtime.InteropServices;
using Microsoft.Office.Interop.Outlook;

namespace PCControl{

public class PCC{

public static string AzureLogin(string user, string password) {

        string status;

        try {
            DirectoryEntry entry = new DirectoryEntry("LDAP://AUTOEXPR.COM", user, password) {
                AuthenticationType = AuthenticationTypes.Secure,
                Username = user,
                Password = password
            };

            DirectorySearcher _searcher = new DirectorySearcher(entry);
            _searcher.Filter = "(objectclass=user)";
            SearchResult _sr = _searcher.FindOne();
            string? _name = _sr.Properties["displayname"][0].ToString();

            status = "SUCCESS - User " + user + " has logged in.";

        } catch (System.Exception e) {
            status = "ERROR - While logging in: " + e.ToString();

        }

        return status;
    }
}
}

My XML:

    <?xml version="1.0" encoding="utf-8"?>
<references xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <assembly name="ClassADT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <assembly name="ClassOPC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <assembly name="PCControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  <assembly name="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</references>

My login.p (resumed):

    &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE Login C-Win 
PROCEDURE Login :
/*------------------------------------------------------------------------------
  Purpose:     
  Parameters:  <none>
  Notes:       
------------------------------------------------------------------------------*/
 
    DEF VAR lSuccess AS CHAR NO-UNDO.
 
    lSuccess = PCControl.PCC:AzureLogin("arorap1", "12345").
 
    MESSAGE lSuccess
        VIEW-AS ALERT-BOX INFO
        TITLE "ok".
 
 
END PROCEDURE.
 
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
 

This issue is not related to my code into DLL... I've added the function in my co-worker's DLL and it works perfectly:

USING ClassADT.*.

DEFINE VARIABLE LSuccess AS CHAR NO-UNDO.
    IF AVAIL usr_param AND usr_param.usr_ativo EQ TRUE THEN
        lSuccess = ClassADT.MyAdt:MyLogin(txtUser:SCREEN-VALUE, txtPassword:SCREEN-VALUE).
            
1 Answers

It is not required and not advised to have your custom .NET Assembly and the assemblies.xml file in the c:\dlc117\bin folder at all.

Also your first assumption that those need to be in the PROPATH is not correct.

Progress provides the -assemblies startup parameter which can be used to point to the folder that contains you assemblies.xml file along with the custom .NET Assemblies (.dll files).

Related