Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to use local version of C# dll instead of IIS default version of the library in an X++ Project?

Posted on by 2

Hello,

I have a C# project where I have added 2 reference dlls Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.DependencyInjection.

I also have a X++ project where I use this C# project. So I first build the C# project and then add it as a reference in my X++ project.

The issue I am facing is that there are already an older versions of Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.DependencyInjection present in AosService//PackagesLocalDirectory//bin directory.

The library I have included is present in K://AosService//PackagesLocalDirectory//MyModel//bin after the build.

Now during runtime, when the X++ code calls the .Net classes, IIS service loads the version of the library from PackagesLocalDirectory instead of MyModel's directory. Which gives me an error in my code.

I tried to delete the dll from PackagesLocalDirectory, in which case it is loading the dll from MyModel's bin and my code runs fine in this case.

Now I don't want to delete dlls from PackagesLocalDirectory and it's also not possible in production. Is there any way so I can load my version of the dll at runtime ? 

It is similar to issue mentioned in the post https://community.dynamics.com/forums/thread/details/?threadid=7d01d7ee-7945-42fd-a0f6-24a0b5524bd5, however the solution provided in the post is something that is not feasible in my case.

Also that is very old post hoping that something might have been changed since then.

Thanks in Advance

Amit

  • How to use local version of C# dll instead of IIS default version of the library in an X++ Project?
    I am not able to use the version present in F&O it is old one, that means I am left with only choice of moving my logic outside of F&O.
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    How to use local version of C# dll instead of IIS default version of the library in an X++ Project?
    There is no way, as far as I know. And that's what Microsoft confirmed in the thread you mentioned.
     
    You could do it in your development environment, but not in production, therefore it would solve nothing.
     
    Therefore either you stick to the version used by F&O, or you implement your logic outside F&O (e.g. in an Azure function).

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans