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 / How do I reference a ....
Finance forum

How do I reference a .dll in an X++ class in D365?

(0) ShareShare
ReportReport
Posted on by 152

I feel like I'm missing something obvious, but I took a .dll SDK and added it as a reference to my project and created an X++ class. I added "using" lines at the top of the class, but I'm getting "A reference to 'xxx' is required to compile this module."

Autocomplete is detecting the class and providing suggestions. What am I missing? See image below:

DLLIssue.png

  • Verified answer
    Jie G Profile Picture
    Microsoft Employee on at

    Hi Wmyk,

    You still need to add reference to netstandard, which the sdk is referenced to.

    Please check the Version of .Net framework in your system, you can check in VS: Help -> About Microsoft Visual Studio.
    4428.0.PNG
    The SDK dll might be built on higher verison of .Net, and the netstandard comes inbox starting from .Net 4.7.1, so you may need to upgrade your .Net framework.
  • Wmyk Profile Picture
    152 on at

    I have the same version of .Net as your picture. How can I check if the SDK dll is on a higher .Net version? It's for a D365 environment, so is upgrading my .Net version feasible given that it could eventually be on a production machine?

    Is there an actual "netstandard" reference, like "System" or "System.Core" that I need to add? I'm newer to .Net dev if that's not obvious.

    VisualStudioVersion.png

  • Wmyk Profile Picture
    152 on at

    I have access to the SDK source and it looks like there's a ".NETStandard 2.0" dependency.

    I just took the assembly because the source seemed to only work on VS2017 and not VS2015.

    Do the D365 VM's not support .Net Core? Or can I convert the SDK to .Net Standard?

    7774.NetStandardDependency.png

  • Verified answer
    Martin Dráb Profile Picture
    240,845 Most Valuable Professional on at

    D365FO isn't a .NET Core application. The VM surely can host .NET Core application, but that's not going to help you.

    Anyway, it seems that you've picked a wrong build of the SDK. It compiles just fine for me with the one for .NET 4.0. (I've downloaded the NuGet package, unzipped it and took the file from lib\net40).

  • Wmyk Profile Picture
    152 on at

    Since I can't use NuGet on D365, I took the source from GitHub, compiled it, took the version in bin\net40 and it didn't work for me. I didn't realize I could just download/unzip a NuGet package.

    I changed the .csproj "<TargetFramework>" to only target "net40" and removed the other two and recompiled, then took the new DLL and it worked for me. I have no idea?

    ChangeToSDK.png

  • Jie G Profile Picture
    Microsoft Employee on at

    Hi Wmyk,

    Can you find this dll in your VM? You can tried to add reference to it and compile again.

    1856.0.PNG

    Please refer this known issue: github.com/.../542

  • Wmyk Profile Picture
    152 on at

    I have that folder, but that DLL is not there.

    It seemed like that issue is when compiling it in VS 2017, it targeted the 3 different frameworks for output, and somehow the net40 file still had references to netstandard. When I changed the .csproj as pictured above and re-compiled it, it worked.

    And the D3FO machines do not support .Net Standard (I think)?

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