This message is for C/AL programmers...

FranklinFranklin Member Posts: 253
Hi all!!

I have the typical programming error...

This message is for C/AL programmers:
Colud not create an instance of the OLE control or Automation server indentify by GUID={00000000000000000}1.0:{00000000000000000000000}: 'netPrint'.netPrintI.
Check that the OLE control or Automation server is correctly installed and registered.


I have seen many posts concerning this but none have found the reasons for this error. Anybody can tell me where to come for error?

netPrint si a dll (An automation dll in NAV)

I can see the class Print so the dll i think, is correctly.

The dll is created in framework 2.0

... help plz... ](*,) ](*,)
«1

Comments

  • IsakssonMiIsakssonMi Member Posts: 77
    This means that the DLL isn't registered.

    You have two options when registering the dll:
    If the dll is signed with a strong name (find out by using sn.exe -v yourfile.dll):
    register it with regasm.exe
    place it in the gac with gacutil.exe
    If it has no strong name:
    register it with regasm.exe using the /codebase argument.

    I guess you will need the tlb-file that are related to the dll-file when you register it with regasm using the /tlb argument.
    If the tlb-file is missing I guess you can use tlbexp.exe to create one.

    Use google to find out more.
  • FranklinFranklin Member Posts: 253
    Thx IsakssonMi!!

    I have registered the dll like this:

    regasm.exe netPrint.dll /tlb:netPrint.tlb (I have the netPrint.tlb too)
    and then...
    gacutil /i netPrint.dll

    But the message is the same... ](*,)
  • IsakssonMiIsakssonMi Member Posts: 77
    When you registered, did you run a command prompt as Administrator? and did the regasm return successful?
  • FranklinFranklin Member Posts: 253
    Yes... everything seems right.
  • IsakssonMiIsakssonMi Member Posts: 77
    Maybe you need to assign the object by browse for the automation again. It could be a mismatch of the classid.
  • FranklinFranklin Member Posts: 253
    :( I have already done it and i´ve the same problem...

    It´s very strange...
  • SavatageSavatage Member Posts: 7,142
    did you search the forum for automation?
    what's your code look like? do you have a line of code like below?

    IF ISCLEAR(MyAutomation) THEN BEGIN
    CREATE(MyAutomation);
  • FranklinFranklin Member Posts: 253
    Yes Savatage... i was looking for information but i couldon´t find the solution...

    My code is:

    IF ISCLEAR(netPrint2) THEN CREATE(netPrint2);
    netPrint2.Imprimir(vRutaImpresion);

    These are all the steps:

    1.- Open command prompt as Administrator

    2.- Copy netPrint.dll and netPrint.tlb in C:\Windows\Microsoft.NET\Framework\v2.0.50727

    3.- In the command prompt --> regasm.exe netPrint.dll /tlb:netPrint.tlb (I have the netPrint.tlb too)

    4.- In the command prompt --> gacutil /i netPrint.dll

    5.- I drag the dll from C:\Windows\Microsoft.NET\Framework\v2.0.50727 to C:\Windows\assembly

    6.- Open NAV form

    7.- Create the variable netPrint2 type Automation and select my dll. All seems correct.

    8.- Write the code:

    IF ISCLEAR(netPrint2) THEN CREATE(netPrint2);
    netPrint2.Imprimir(vRutaImpresion);

    I did the same with other dll some months before and everything is right and i tried to use the dll in other machine but nav shows the same error.
  • frost_amofrost_amo Member Posts: 22
    If you are using Windows Vista or Windows 7, try to disable UAC (User Access Control). Sometimes UAC blocks the creation of an instance of Automation objects.
  • FranklinFranklin Member Posts: 253
    Yes, it was disabled... :( because i couldn´t copy the dll to assembly...
  • frost_amofrost_amo Member Posts: 22
    You can also try to copy the DLL and TLB files to the root directory of the NAV client. Success is not guaranteed, but anyway...
  • IsakssonMiIsakssonMi Member Posts: 77
    You shouldn't copy the dll and tlb-file to the assembly directory, the gacutil does this for you.
  • FranklinFranklin Member Posts: 253
    frost_amo wrote:
    You can also try to copy the DLL and TLB files to the root directory of the NAV client. Success is not guaranteed, but anyway...

    Where is the directory?

    :-k
  • frost_amofrost_amo Member Posts: 22
    The default directory path is C:\Program Files\Microsoft Dynamics NAV\CSIDE Client
  • FranklinFranklin Member Posts: 253
    It doesn´t work...

    Do you think the problem is the .dll or the registration?
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    Are you using some kind of Citrix or RDP connection for your NAV?
    Did you try the old fashioned way to register your dll (regsvr32)?
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • FranklinFranklin Member Posts: 253
    Hi, einsTeIn.NET

    No. I´m triying to register .dll in my machine with a local database...

    regsvr32 doesn´t work... "Module is loaded but not found the entry point DllRegisterServer"

    Pufff the solutions come to an end... ](*,)
  • frost_amofrost_amo Member Posts: 22
    It is very strange that your COM object has empty GUID (GUID={00000000000000000}1.0:{00000000000000000000000}:)

    Could you tell more about netPrint.dll?
    If it is provided by some software vendor (not created by you), does they also provides some info\help about how to use it?
  • FranklinFranklin Member Posts: 253
    frost_amo the GUID is not empty... i write it like this but isn´t empty.

    The dll is created by our Technical Programmer.

    What dou you need about the dll? If you want i can send you... it´s a very simple dll
  • frost_amofrost_amo Member Posts: 22
    I think something wrong with your dll.
    I suggest you to ask your Technical Programmer to check some (obligatory for COM) attributes of your interfaces/classes such as:
    - [ComVisible(true)]
    - [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    - [ClassInterface(ClassInterfaceType.AutoDispatch)]
    - [Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")]

    Also you might need to assign DISPID for the public methods which are exposed to COM:
    [DispId(1)]
    public void MyMethod()

    More information you can find on MSDN.
  • FranklinFranklin Member Posts: 253
    Thx... i´ll try!!! :thumbsup:
  • FranklinFranklin Member Posts: 253
    Well the problem is this...

    When i execute gacutil.exe /i netPrint.dll in C:\Windows\Microsoft.NET\Framework\v2.0.50727 the message is... "Assembly successfully added to the cache" but then i write gacutil.exe /l netPrint.dll to check it and the message is... "Number of elements assembled = 0"

    It seems that gacutil doesn´t work!!! ](*,)
  • frost_amofrost_amo Member Posts: 22
    There might be some restrictions with permissions for folder C:\Windows\Microsoft.NET\Framework\v2.0.50727.

    Try to create new folder somewhere on your hard drive (for instance, C:\netPrint). Make sure that you have full control to this folder.
    Do everything from scratch:
    1. From command prompt run "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" C:\Windows\Microsoft.NET\Framework\v2.0.50727\netPrint.dll /unregister
    1. Copy the dll and tlb files to the C:\netPrint folder
    2. From command prompt run "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" C:\netPrint\netPrint.dll /tlb:C:\netPrint\netPrint.tlb
    3. Drag and drop the netPrint.dll from C:\netPrint to the C:\Windows\assembly folder. Make sure that the dll is published in it.
    4. Restart NAV Client and try again...

    Good luck :)
  • FranklinFranklin Member Posts: 253
    Nothing...

    The same error... and i´ve tried to register with gacutil in c:\netPrint but the message is... "Number of elements assembled = 0"

    Why???? This is the problem i think.
  • frost_amofrost_amo Member Posts: 22
    What else can I say... :roll:

    Probably your assembly is not signed (by sn utility).

    If this is the case, you can disable verification of signing for this assembly.

    In order to do this you should have Visual Studio (for instance, 2008) installed on your machine:
    1. Go to the Start -> All Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt
    2. In the Visual Studio 2008 Command Prompt type and execute sn -Vr *,xxxxxxxxxxxxxxxx. Where the "xxxxxxxxxxxxxxxx" is the PublicKeyToken of your assembly.

    After that .net will not verify the sign of your assembly on the certain machine.

    Maybe it will help!
  • frost_amofrost_amo Member Posts: 22
    .. or you can simply use sn -Vr netPrint.dll
  • FranklinFranklin Member Posts: 253
    Thx frost_amo i´ll try it...

    EDIT: I managed to join the dll on my computer.

    I had to install the framework SDK 2.0 -> Control Panel -> Administrative Tools -> Configuration Framework 2.0 -> and I've added manually.

    The problem is that the customer's server I can not install the sdk ... and therefore did not assemble them into cache.

    so... the dll is correct.
  • IsakssonMiIsakssonMi Member Posts: 77
    Franklin wrote:
    Thx frost_amo i´ll try it...

    EDIT: I managed to join the dll on my computer.

    I had to install the framework SDK 2.0 -> Control Panel -> Administrative Tools -> Configuration Framework 2.0 -> and I've added manually.

    The problem is that the customer's server I can not install the sdk ... and therefore did not assemble them into cache.

    so... the dll is correct.

    Installing the SDK? Something is really wrong here.. your technical programmer who made the assembly, does he(she) knows what he(she) is doing?

    To make a COM-interop DLL in .NET is very easy.
    *) Sign it by the feature under project properties (password is unnecessary in your case :)), make it com-visible by assembly settings.
    *) Use an interface to expose the methods/properties (mark the interface by the attribute [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)])
    *) Always hide the class by the attribute [ClassInterface(ClassInterfaceType.None)]
    *) I guess that's all..

    I saw another post regarding regsvr32.exe, that program is used to register unmanaged (VB6/ATL/OCX/More) COM-servers (not .NET).

    Regasm.exe is used to register managed (.NET) COM-servers.
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    IsakssonMi wrote:
    I saw another post regarding regsvr32.exe, that program is used to register unmanaged (VB6/ATL/OCX/More) COM-servers (not .NET).

    Regasm.exe is used to register managed (.NET) COM-servers.
    Yeah, I know. At that point in time it wasn't clear to me that they developed their COM-Server on their own. I guessed that it is maybe an old COM-Server based on another IDE.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • FranklinFranklin Member Posts: 253
    I´m not a technical programmer but i think the dll seems correct because it runs in my computer (but it only runs if i install the sdk framework 2.0...) but i can´t install this in all client computers...

    We have done all...

    Now, if i write gacutil /l netPrint.dll (we are in the fourth version to avoid oldest version) Number of elements assembled = 1 but the error is the same...

    We have 3 dlls and i have never had this problem... it seems very easy but the reality is other in this case... ](*,)
Sign In or Register to comment.