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 :
Microsoft Dynamics AX (Archived)

Simple runnable class code fails to compile, then causes the compiler to fail.

(0) ShareShare
ReportReport
Posted on by 230

The code following code fragment fails to compile with the error:

A reference to 'Dynamics.AX.FiscalBooks', Version=0.0.0.0, Culture-neutral, PublicKeyToken=null' is required to compile this module.

If I add a reference to J:\AosService\PackagesLocalDirectory\FiscalBooks\bin\Dynamics.AX.FiscalBooks.dll, it then fails with the 3 errors:

X++ compiler exited unexepectedly with failure code -1.

Compilation failed.

Abnormal termination with unhandled exception. Exception key: 765d805b-72e6-4d9f-adcd-c994d2f5cd7f. System.IO.FileNotFoundException: Could not find file 'J:\AosService\PackagesLocalDirectory\dwd_RC2\bin\Dynamics.AX.FiscalBooks.Queries.0.netmodule'. ...

Removing the reference does not return to the original state, but continues to produce the same 3 errors.

What I am trying to do (ultimately) is test the existence of an InventSite record corresponding to the operating unit number of an OMOperatingUnit record. Why can I not do the selection?

class RC2
{
    public static void main(Args _args)
    {
        OMOperatingUnit ou;
        InventSite site;

        while select ou
        {
            var depot = ou.OMOperatingUnitNumber;
            select site where site.SiteId == depot;
        }
    }
}

*This post is locked for comments

I have the same question (0)
  • DD-19021315-0 Profile Picture
    230 on at

    And it seems that the code fragment below required Dynamics.AX.ContactPerson, and providing that also causes a compiler fail with 'file not found' as above...

    public class MyParties extends common
    {
        public RefreshFrequency xds()
        {
            VendTable vendTable;
    
    ////all other code commented out... (including insert_recordset and where clause)
    
                        select firstonly AccountNum
                        from vendTable;
    
    ////all other code commented out...
    
             return RefreshFrequency::PerSession;
        }
    }
    

    Have I managed to break my development setup? If so, how do I fix it?

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    The error above says that your model doesn't refer to all packages you need, namely the FiscalBooks package.

    Go to Dynamics 365 > Model management > Update model parameters, select your model and add the reference.

  • DD-19021315-0 Profile Picture
    230 on at

    Thanks Martin. That fixed it. 

    I assume it's due to a 2nd level or higher reference since, for example, if I refer to OMOperatingUnit I get an error that the item isn't defined, which, to me, clearly indicates I've omitted a model reference. The message above seems to indicate a binary reference and it's not obviously also a model management problem.

    Thanks again.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    You have a point here. It's quite obvious to me, as I usually think more about underlying .NET concepts as assemblies, but it's true that AX tries to hide these behind packages and models and this hiding doesn't succeed in all cases. It may be consider a leaky abstraction. In either case, it's helpful to understand how AX concepts maps to CLR concepts, how the runtime look for assemblies (DLLs) is needs and so on.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans