web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Add DLL to D365 F&...
Finance forum

Add DLL to D365 F&O project and use it in X++ class

(0) ShareShare
ReportReport
Posted on by 190

Hi

I am trying to add dll reference to unified operation project and consume the methods inside dll into x++ class. Please help.

Thank You

--Pradeep

  • Martin Dráb Profile Picture
    241,445 Most Valuable Professional on at

    What problem do you have with it?

  • Pradeep00 Profile Picture
    190 on at

    I have added the dll in reference node. Is that correct or I have to perform some additional steps here ? And I have no idea how to consume it in x++ class.

  • Martin Dráb Profile Picture
    241,445 Most Valuable Professional on at

    If you've got a DLL, then adding it as a reference is the right approach. If it's something you're developing, a project reference is often a better choice.

    How you can use the code inside the DLL and whether it's possible at all depends on what's there. Please give us more information about it.

  • Pradeep00 Profile Picture
    190 on at

    I have a DLL (written in C#) with several methods  that I need to call from X++. I have created a reference in the AOT to the DLL but when I try to use it in the X++Class. Intelligence does not have the classes or methods available an options.

    No matter what I try, X++ does not recognize the classes or methods.  Is there something other than setting the references that I need to do?

    using System;

    namespace Calcs

    {

      public class Operations

      {

          public static int add(int a, int b)

          {

              return a + b;

          }

          public static int substract(int a, int b)

          {

              return a - b;

          }

          public static int multiply(int a, int b)

          {

              return a * b;

          }

      }

    }

  • Verified answer
    Martin Dráb Profile Picture
    241,445 Most Valuable Professional on at

    Then I would use a project reference rather than dealing with the file.

    Anyway, if you do it manually (building your project to DLL, adding the DLL to bin folder, adding a reference to application), it'll work in the same way. But you'll have to deal with the file every time when you change the code.

    When you have the file and the reference in place, you should be able to call methods in this way: Calcs.Operations::add(1, 2);

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans