Code highlighting

Showing posts with label xref. Show all posts
Showing posts with label xref. Show all posts

Monday, February 09, 2026

Cross references in Dynamics 365 ERP (Finance and Operations) that are somewhat easier to work with

Ever since the migration to Visual Studio as the primary IDE for AX, one of the complaints from developers has been how cumbersome it has become using the cross references, as it was using the default cross references viewer from Visual Studio. 

Engineers looked for ways to make life at least a bit easier by building all sorts of weird extensions and tools. One such tool I have shared in 2016 in the following post: Development tool: Copy 'Find references' results to clipboard (to Excel) in Visual Studio for AX 7.

Well, in the 10.0.47 / PU71 release of Dynamics 365 ERP we finally see some improvements to the Cross References tool.


Here's how it looks now:

Cross References view in Visual Studio


The benefits are:

  • You can now exclude test models, which is great as that used to get in the way a lot when looking for code
  • You can now group the references by model and/or type.

In the image above you can see I've chosen to show the cross references for WHSWorkTable, excluding test models and grouping by the element type. This helped narrow down my search significantly, where I was looking for forms, where work table is one of the data sources.

Some things that are still missing, and will hopefully be added in a future update:

  • Ability to further search over the results
  • Matching the theme to the VS / Windows theme, by supporting Dark mode
  • (very unlikely) Read/Write designation like in old AX versions

Are there any other Cross References features you would like to see? 

Let me know in the comments, and I'll make sure the owning team is made of aware of the request.


Thursday, October 06, 2016

Development tool: Copy 'Find references' results to clipboard (to Excel) in Visual Studio for AX 7

Problem

With the release of Microsoft Dynamics AX 7 the development moved to the Visual Studio environment.

This had a lot of advantages, like the ability to use any 3rd party add-ons of various sort (which we actually have not seen that many of being applied to AX so far), all the VS goodies that come out of the box, a more familiar IDE for new developers, etc.

But it also has its disadvantages, like the Cross-References display window.

  • First of all, the indicator of whether a particular reference is writing or reading is gone. 
  • And we now display the xRefs using the standard Visual Studio "Find Symbols Results" window, which has one huge drawback as well - no way to filter on the data displayed, or copy that data somewhere else to do that.

Solution

I was bothered by this lack of functionality for a while, so I went out to find if there's an existing solution. I came across this post, which seems like a sufficient solution for the problem, in my opinion. Kudos to the author!

I have modified the project a bit to better suite AX needs, as I planned to browse the data in Excel, which has rich filtering capabilities and more convenience in navigation, and uploaded it to GitHub so anyone can use and extend it. You can also just download the executable, if are OK with the out-of-the-box functionality I will describe below.

Project on GitHub:

Executable on my OneDrive:

Installation guide

Once you have the executable, place it in a folder on your environment running Visual Studio for AX, say, C:\Tools or whatever you prefer.

Now, from Visual Studio, go to Tools and select External tools..., as shown below:

External Tools... under Tools menu in Visual Studio

Now add a new tool by clicking Add, and specify the Title, Command and Initial directory.
The Command  should contain the path to the CopyFindReferencesToClipboard executable

Add the CopyFindReferencesToClipboard tool

User guide

Using the tool is very simple. Say I wanted to find all references to the WHSLoadLine.Qty field.
I would navigate to that field and select Find references from the context menu. 

Find references to the WHSLoadLine.Qty field
This would bring up the standard Visual Studio dockable window Find Symbol Results, containing all the references to the selected table field.

Now, all you need to do is go to Tools and select the newly added tool from the list, as shown below:

Run the tool to copy the references to clipboard
After a few seconds you will get a message box to pop up telling you the references have been copied to clipboard successfully, which means you can now to and paste the data to Microsoft Excel.



Note. Since the tool uses UI-level automation to copy the cross-references, the Find references window needs to be open and visible for the tool to work.

Now, you can do whatever you want with that data in Excel.
The way I typically use it is by just showing the data as a Table, after which:
- Exclude test related files (Actual tests and Test frameworks we used)
- Filter out only elements in a certain area, like WHS
- Build pivot tables/charts, if I am doing complexity analysis for a change / feature
- etc.

Here's how it looks:

Analyze the cross-references in Microsoft Excel

Feeback

Give it a try and let me know what you think!