Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Answered

how to call a method from a .net (C#) dll within Nav C/AL codeunit

Posted on by 5,124

I have a dll I created from .NET (C#) utilizing the .net Framework 4.0.  After testing and making sure the dll works, I copied the dll file into the /Role Tailored Client/add-ins folder in the client pc as well as the /service/add-ins folder of the Nav server.  Then I stopped and restarted the Nav services.

Then in my codeunit, I created an automation variable and found the Dll that I just copied into the respective folders.  Note that I didn't do regasm.

The problem is when I instantiated the variable, I CANNOT find its methods. The dll is supposed to have one method available to me.  I set it up as Public.

Any thoughts? 

  • Krish Roy Profile Picture
    Krish Roy 35 on at
    RE: how to call a method from a .net (C#) dll within Nav C/AL codeunit

    Yay !!!! It worked. Thank you !!

  • mbr Profile Picture
    mbr 5,124 on at
    RE: how to call a method from a .net (C#) dll within Nav C/AL codeunit

    Hello Rockwith Nav,

    You are absolutely right! I stopped bothering with having to register the dll and simply pasted onto the client rtc's addin folder.  THen in the variable declaration, I chose dotnet (as opposed to automation) and clicked onto the dynamics nav tab and there it was, the dll I added into the add-in folder.  Woohoo! So I am good. 'glad I don't have to bother with registration of dll anymore.  Thank you much.

  • mbr Profile Picture
    mbr 5,124 on at
    RE: how to call a method from a .net (C#) dll within Nav C/AL codeunit

    Hello Rockwith Nav,

    I thought so too.  But  i didn't see it when selecting dotnet.  Note,i have registered the dll yet. I just copied into the add-in folder in the RTC and then in the services\add-ins of the server.  BUt i think i need to register still as i don't see it in the test server either when selecting automation or dotnet in the variables section of the codeunit.  I didn't have any problem in my dev pc of course.  SO i am thinking i need to copy the dll in the c:\windows\assembly and then perform a regasm.  HOwever, i am unable to drag and drop the dll into the C:\windows\assembly folder.  Thoughts?

  • Verified answer
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: how to call a method from a .net (C#) dll within Nav C/AL codeunit

    Hey MBR,

    What I understood is you need to call a Method of the DLL that you created from C# and you want to use this DLL in NAV.

    If this is the case then you simply need to paste the DLL in this folder C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins. Once the DLL is available there you can go in NAV make a new Datatype of DotNet and there you will find your DLL with all Methods.

    Good Luck :)

  • Binesh Profile Picture
    Binesh 7,885 on at
    RE: how to call a method from a .net (C#) dll within Nav C/AL codeunit

    Hello,

    Read this article How to: Create a Windows Client Control Add-in

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans