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 :
Supply chain | Supply Chain Management, Commerce
Answered

How to source control AX model code? (Local Git repo)

(0) ShareShare
ReportReport
Posted on by 20

Hello, we primarily develop custom AX classes and objects, and I have model with many new classes and extensions I need to version control. 

I want to control within the Visual Studio 2017 environment we build X++ code in, preferably with a local git repo. I understand the solution file is only linking to objects from the application explorer, so for each model or model's subproject we will have a solution file pointing to all the relevant AX objects. But the AX objects themselves are not accessible to the solution (correct?).

For master solution files how can I add the AX object dealing with X++ code to my source control?

I can find what seems to be the up-to-date code on a location on the dev VM such as K:\AosService\PackagesLocalDirectory\{model}\{model}\AxClass, but creating a solution file in that folder and adding the AxClass contents yields an error below:

pastedimage1634343099104v1.png

This was just a guess, I'm not sure directly versioning the contents of \AosService\PackagesLocalDirectory is the correct move, but source controlling any file that can reflect X++ codechange is the goal. 

Thanks

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Start by checking the documentation. It talks about TFVC, but it'll give you some idea for Git as well. As you see, you need to map two separate folders - PackagesLocalDirectory and Visual Studio projects.

    The documentation maps the whole PackagesLocalDirectory folder, but if you want, you can map individual packages (subfolders of PackagesLocalDirectory).

    I suggest a slightly different approach - map the whole branch (with Metadata and Projects subfolder) to a local repository (not to PackagesLocalDirectory).Add symbolic links for standard packages to your Metadata folder and then you can reconfigure Visual Studio to use a particular branch folder instead of PackagesLocalDirectory. It may sounds complicated, but it actually makes things (e.g. branch merging) simpler, at least with TFVC .

  • Suggested answer
    RFgenCT Profile Picture
    20 on at

    Thanks Martin,

    I did attempt the steps in the documentation for TFVC, and while I was not successful in implementing it exactly as the documentation describes it did point me in a direction to make it work. I'm not sure if there are differences in the VisualStudio versions or the DevOps portal described, but I'll share my experience below in-case anyone runs into similar ambiguities and are brand new to TFVC like me.

    We setup a TFVC project in DevOps under our tenant, a git repository won't work with these steps.

    Confirm VisualStudio's source control plugin as TFVC under Tools > Options > Source Control. It might be set to Git by default.

    Attach VisualStudio to the DevOps server and your TFVC repo.

    Create a workspace and map some folder in the DevOps repository to your local Packages directory (i.e. for me K:\AosService\PackagesLocalDirectory\<model name>)

    Map another folder in DevOps to your local folder(s) containing the VisualStudio solutions (i.e. for me C:\Projects\<folders to .sln's>)

    Now all the files within a solution should be mapped and addable to TFVC source control. I found I needed to fiddle with opening the .sln's from Team explorer sometimes to get it to sync with my source control rather than Git. But after all was setup, all my AX code is being tracked and saved on our DevOps as needed.

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 > Supply chain | Supply Chain Management, Commerce

#1
Siv Sagar Profile Picture

Siv Sagar 266 Super User 2025 Season 2

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 213 Super User 2025 Season 2

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans