Problem with Automation with C# Dll

ombackeombacke Member Posts: 44
Hi,
I wrote some code in C/Side where I point to a C# dll through automation. Calling the dll works fine. You can call mehods on it and all.
So when I import the navision object and i import it agai n another installation the call to the dll doesnot work anymore. It says that it can't find the automation server or something like that...
To make it work i need to get in the code and reset the link to the dll.
Is there a way not to have to do all that???

Thanks

Comments

  • DenSterDenSter Member Posts: 8,307
    The dll itself must be present and registered on the client machine for Navision to be able to work. The principle is the same as trying to open a Word document without having Word installed. If the Navision code works on your machine, then the dll is registered there. If the same code does not work on another machine, all you need to do is register it on that machine and the Navision code should work right away.

    There is no way around having to register the dll. I remember someone posting a way to store the dll inside the Navision database and registering it dynamically, but I don't know how that works exactly, or if that would work on a .NET assembly.
  • admoretutsieadmoretutsie Member Posts: 79
    Register the dll i.e Copy the dll onto the new client machines' HDD, and go into command prompt. cd into the dir with the dll, and run "regsvr32 dllname.dll", where dllname is the name of your dll. You should get a msg saying reg was done succesfully. Now you can proceed!
    $cside -MBS
    >install Navision::4.0 SP1
    >q
    $
    oOo
  • nunomaianunomaia Member Posts: 1,153
    To use automatic registration of COM controls use ClickOnce that comes with .NET.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • ombackeombacke Member Posts: 44
    But if the dll u register ust be the same version as the dll you compiled and iported the object with??
  • nunomaianunomaia Member Posts: 1,153
    In .NET you have

    [assembly: Guid("xxxx-xxxx-xxxx-xxxx-xxxx")]
    [assembly: AssemblyVersion("1.0.0.0")]

    Navision only sees Guid. If you change AssemblyVersion but keep untouched the Guid there is no problem with Navision.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • ombackeombacke Member Posts: 44
    How do ou assign the GUID or where do you get the GUID from???

    Also i have another question. When I register the dll. After i come back, unregister it. Then i regiser a new version of the dll... Now when i go to the code unit to choose a dll, I have the dll twice in the list.. With one of the dlls with no classes..... Is that normal??? Does Navision keep in memory old dlls??
  • nunomaianunomaia Member Posts: 1,153
    GUID is in a file in the project, normally in the AssemblyInfo.cs. The creation of the guid is automatic with the project.

    Reasons to appear the same DDL twice (just guessing…)

    You have register the same DLL with to different GUID
    You have unregistered de DLL but DLL was still in use I Navision or in another program.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • kinekine Member Posts: 12,562
    If you do not use GUID and Strong name for your DLL, each build of the dll will be registered as another version and Navision will lost the connection to this DLL (you will need to select it once more...).

    ANd of course, you need to install this dll on each PC, where the Navision will use this dll...

    The registration process is not done through regsvr32, it is done through RegAsm.exe
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.