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... ](*,) ](*,)
0
Comments
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.
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... ](*,)
It´s very strange...
what's your code look like? do you have a line of code like below?
IF ISCLEAR(MyAutomation) THEN BEGIN
CREATE(MyAutomation);
http://www.BiloBeauty.com
http://www.autismspeaks.org
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.
Where is the directory?
:-k
Do you think the problem is the .dll or the registration?
Did you try the old fashioned way to register your dll (regsvr32)?
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... ](*,)
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?
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
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.
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!!! ](*,)
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
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.
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!
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.
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... ](*,)