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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Reference to a model

(0) ShareShare
ReportReport
Posted on by 32

Hello everyone,

I'm developing a solution for D365 FO, which consist of 2 projects X++ and C#. I have followed Microsoft Docs article https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-tools/write-business-logic

where it says to include reference to a model and set the property Copy Local = False which I did. But when I move it to another environment this reference is missing. Do I need to include something in VSTS before shelving/checking in?

Thank you in advance,

Alex

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Alex,

    Have you added dll from bin folder under D365 model folder to source control?

    d365byjp.blogspot.com/.../adding-c-project-reference-to-d365.html

  • Alex Nach Profile Picture
    32 on at

    Spacibo Sergei.

    I saw this article before and added my C# dll/xml to the VSTS. It then added files to appropriate directories under "AOSService\PackagesLocalDirectory\Model\Model".

    I was referring to the d365 model though that my company is using to build any custom solutions. Do I need to add D365 model dll as well the same way I added C# dll? I'm referencing several tables from within C# project.

    I thought about copying it into the bin C# folder like I did with other Microsoft.Dynamics.AX.Framework references but isn't that bad? Since it's a copy what happens if any changes are made? I apologize for all the questions. I'm just new to all this.

    Thanks,

    Alex

  • Alex Nach Profile Picture
    32 on at

    Any ideas? Appreciate it.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Alex,

    If we are talking about C# project and linking to D365 model, only dll produced by C# project should be added to D365 model bin folder. If you deliver this model to another environment it will already contain C# dll in it.

    And if you make any changes in C# project, you will get another dll and it should be updated in source control as well (some kind of new version of your D365 model).

    Did I answer your question? Or you meant something else

  • Alex Nach Profile Picture
    32 on at

    Not exactly Sergei. From the article I posted link to (this step in particular):

    7. In Solution Explorer, select the reference Dynamics.Ax.FleetManagement.dll reference and set the property Copy Local = False.

    I did the same in my solution. The only difference is I have different model, not FleetManagement. I need this reference to access D365 tables and do inserts from within C# project. When I move solution to QA environment this reference is missing (no path). In development, everything is on C: drive and on other environments drive could be very different. I hope this helps.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Alex,

    Now i understand. You have also reference to D365 model in C# project. So you have D365 model dll in C:\Package and reference it in C# project. But still you have reference to C# project in D365 model. When you build C# project it will produce dll and put to D365 model bin folder and you add it to source control.

    Then you deliver D365 model to QA environment and link to C# dll is missing? Or you are trying to deliver C# project to QA environment?

  • Alex Nach Profile Picture
    32 on at

    yes. I added model to  C# as reference, as per article, but when I shelve my project and move to another environment, the model reference is broken.

    7635.Capture1.JPG

  • André Arnaud de Calavon Profile Picture
    301,231 Super User 2025 Season 2 on at

    Moved to the Dynamics 365 Finance forum.

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Alex,

    It took some time to prepare my own example.

    I've made the next steps:

    1. Create new D365 model + project

    2. Create new C# project and add references like in article (i used K:\Packages and it's a shortcut to K:\AosService\PackagesLocalDirectory)

    3. Added reference in D365 to C# project

    4. Added dll produced by C# project from D365 model bin folder to source control

    5. C# project added to source control

    6. Opened another environment and got latest version, but in my case, all references in C# project are in place, because K:\Packages folder exists in this environment too. But if I open C# project in another environment where K:\Package doesn't exist it I will get broken reference and i need to re-add it with the correct source.

    I guess you are trying to test C# project instead of D365 model, but you will anyway deliver to sandbox\prod environment D365 model and C# dll included in bin folder from step 4.  Am I correct?

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    -------------------------------------------------------------------------------------------------------------------------------

    I was referring to the d365 model though that my company is using to build any custom solutions. Do I need to add D365 model dll as well the same way I added C# dll? I'm referencing several tables from within C# project.

    I thought about copying it into the bin C# folder like I did with other Microsoft.Dynamics.AX.Framework references but isn't that bad ?

    -----------------------------------------------------------------------------------------------------------------------------

    Hi Alex ,

    If you are trying to  use D365 model dll same as you used external dll in your D365 code then that's  not the correct way to expose business logic with D365 for F or SC. There are different integration  approach to integrate external application with D365 . Take a look at below link to learn about those. 

    https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/integration-overview

    Apart from these you can use power Automate , logic apps and difference azure app services to do integration  with D365.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans