I have still problems. If I use AutoDual for the class, all is ok. In .tlb file there are all method etc. If I do not use AutoDual there is only the class without members. Never the Interface... :-s
May be that problem is that the class is inherited from the Form class and is using some Interface (and not only the interface without inheritating...)
How can I unregister the .net interop DLL? (I know only the way of regsvr32 but this is not the correct one in this case)
One other (much simplier way) to unregister: just remove the "Register for COM Interop" checkmark in the project properties and rebuild the project. This will unregister the dll for COM.
A good programmer makes al the right mistakes My blog
I am trying to do it without Visual Studio, because that costs money you know with the free SharpDevelop IDE. The problem is that this IDE does not provide a project option for registering as a COM object.
So what I am trying to do is the following:
code taken from an example mentioned earlier in this topic
using System;
using System.Runtime.InteropServices;
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface GeneralNavTest
{
int Add2Numbers(int a, int b);
}
[ClassInterface(ClassInterfaceType.AutoDual)]
public class NavTest : GeneralNavTest
{
public NavTest()
{
}
public int Add2Numbers(int a, int b)
{
return(a+b);
}
}
and then I copy it to the Navi client folder, and then
"c:\Windows\Microsoft.NET\Framework\V1.1.4322\RegAsm.exe" "c:\Program Files\Microsoft Business Solutions-Navision\Client\navtest2.dll" /tlb:navtest2.tlb
what happens is that the registration is successful, but it does not appear in Navision under Custom Controls in Tools menu.
Any ideas?
Do It Yourself is they key. Standard code might work - your code surely works.
In order to use a C# dll in Navision the dll must have a strong name. U need a keypair. U can create one using sn.exe. There should also be an interface in you .net application with the public methods..
Once the dll is compiled with the key, you need to put it in the assembly folder and register it using regasm.. Then you're set
I am trying to do it without Visual Studio, because that costs money you know with the free SharpDevelop IDE. The problem is that this IDE does not provide a project option for registering as a COM object.
So what I am trying to do is the following:
code taken from an example mentioned earlier in this topic
what happens is that the registration is successful, but it does not appear in Navision under Custom Controls in Tools menu.
Any ideas?
I just use that code and then put "com visible" and "register for com interop" attribute to TRUE and then it registers it for Navision automatically.
Comments
Use regasm with the /unregister switch at the command line.
My blog
I have still problems. If I use AutoDual for the class, all is ok. In .tlb file there are all method etc. If I do not use AutoDual there is only the class without members. Never the Interface... :-s
May be that problem is that the class is inherited from the Form class and is using some Interface (and not only the interface without inheritating...)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
It turns out that we both overlooked one little keyword 'public'... :oops: :!:
Without making your interface public, Navision will never be able to determine the correct interface of the class when the ClassInterfaceType = None.
Remember, you should set the InterfaceType to ComInterfaceType.InterfaceIsIDispatch (which is default)
My blog
One other (much simplier way) to unregister: just remove the "Register for COM Interop" checkmark in the project properties and rebuild the project. This will unregister the dll for COM.
My blog
Interface:
Class:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
EDIT: God damn, I forgot public ](*,)
I am trying to do it without Visual Studio, because that costs money you know
So what I am trying to do is the following:
code taken from an example mentioned earlier in this topic
and then I copy it to the Navi client folder, and then
what happens is that the registration is successful, but it does not appear in Navision under Custom Controls in Tools menu.
Any ideas?
Do It Yourself is they key. Standard code might work - your code surely works.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Once the dll is compiled with the key, you need to put it in the assembly folder and register it using regasm.. Then you're set
I just use that code and then put "com visible" and "register for com interop" attribute to TRUE and then it registers it for Navision automatically.