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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Custom rate engines gi...
Finance forum

Custom rate engines give error 'Dynamics.AX.ApplicationSuite.124.netmodule' on D365FO

(0) ShareShare
ReportReport
Posted on by 1,461

We have custom transportation rate engines that worked perfectly in AX2012.

We brought them over to D365. We cannot get it to work in D365.

The error I get when I step through the code is:

Message "Could not load file or assembly 'Dynamics.AX.ApplicationSuite.124.netmodule' or one of its dependencies. The system cannot find the file specified." string

Microsoft has provided this link on how to create transportation  rate engines: https://docs.microsoft.com/en-us/dynamics365/unified-operations/supply-chain/transportation/create-new-transportation-management-engine#deploy-the-tms-engine-as-a-package

Nowhere in there does it mention anything special on the build or what version the project needs to be build in. Note that the rate engine project is a mixture between X++ and a C# class library.

When it builds, it generate warnings that I have ignored up till now, but searching for an answer on the error makes me think that I need to look closer at the warning messages.

Here are some:

*****

2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Dynamics.AX.ApplicationFoundation", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Dynamics.AX.ApplicationPlatform", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Dynamics.AX.ApplicationSuite, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

3> No way to resolve conflict between "Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily.

3> No way to resolve conflict between "Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily.

3> No way to resolve conflict between "Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "Microsoft.Data.Services.Client, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily.

3> No way to resolve conflict between "System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Choosing "System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily.

3> No way to resolve conflict between "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.

3> Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.0.0" [] to Version "5.6.4.0" [C:\Users\User5189d4976dc\Documents\Visual Studio 2015\Projects\TMC_3832_TmsSharedParcelEngineData\TMC.ThirdParty.Parcel\bin\Debug\Microsoft.Data.OData.dll] to solve conflict and get rid of warning.

3> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "6.0.0.0" [] to Version "9.0.0.0" [C:\Users\User5189d4976dc\Documents\Visual Studio 2015\Projects\TMC_3832_TmsSharedParcelEngineData\TMC.ThirdParty.Parcel\bin\Debug\Newtonsoft.Json.dll] to solve conflict and get rid of warning.

3> Consider app.config remapping of assembly "Microsoft.Data.Services.Client, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.0.0" [] to Version "5.6.4.0" [C:\Users\User5189d4976dc\Documents\Visual Studio 2015\Projects\TMC_3832_TmsSharedParcelEngineData\TMC.ThirdParty.Parcel\bin\Debug\Microsoft.Data.Services.Client.dll] to solve conflict and get rid of warning.

3> Consider app.config remapping of assembly "System.Spatial, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.0.0" [] to Version "5.6.4.0" [C:\Users\User5189d4976dc\Documents\Visual Studio 2015\Projects\TMC_3832_TmsSharedParcelEngineData\TMC.ThirdParty.Parcel\bin\Debug\System.Spatial.dll] to solve conflict and get rid of warning.

3> Consider app.config remapping of assembly "Microsoft.Data.Edm, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.0.0" [] to Version "5.6.4.0" [C:\Users\User5189d4976dc\Documents\Visual Studio 2015\Projects\TMC_3832_TmsSharedParcelEngineData\TMC.ThirdParty.Parcel\bin\Debug\Microsoft.Data.Edm.dll] to solve conflict and get rid of warning.

3>C:\Program Files (x86)\MSBuild\Microsoft\Dynamics\AX\Microsoft.Dynamics.Framework.Tools.BuildTasks.targets(75,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.Data.OData" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.Data.Services.Client" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Spatial" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.Data.Edm" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /></dependentAssembly></assemblyBinding>

*****

What I read about these errors, is that it means that AX is on one version and that Visual Studio compile sit against another. It looks to me that AX is X86. By default the projects are compiled as Debug/Any CPU. It looks like I need to change it to Debug/X86. I did that but the build gave even more warnings. So I changed it to Debug/X64, but still the warning messages.   

 

So I don't know if I am on the right track to fix my run time exception error.

Can anybody shed some light for me on this error ("Could not load file or assembly 'Dynamics.AX.ApplicationSuite.124.netmodule' or one of its dependencies. The system cannot find the file specified." ) please with a possible solution on how to fix it?

  • Martin Dráb Profile Picture
    241,637 Most Valuable Professional on at

    Is your class library using the conflicting assemblies such as Microsoft.Data.OData? In which version?

    And what's the exact version (both platform and application) of your AX environment?

  • Retha Profile Picture
    1,461 on at

    Hi Martin,

    The AX version is: D365 enterprise edition 7.3 and the platform is: Update12 (7.0.4709.41129)

    Now for Visual Studio, the version of the .Net framework used for the class library is: 4.5.2

    I don't see a reference to Microsoft.Data.OData. We have a reference to System.Data and Microsoft.Dynamics.AX.Data.Core. Don't know if any of these 2 indirectly make use of OData or if the Dynamics classes are using it seeing that Microsoft has moved a lot of the C# classes in AX2012 into X++ classes  e.g. the ones that starts with TmsFwk like TMSFwkIRateEngine

  • Martin Dráb Profile Picture
    241,637 Most Valuable Professional on at

    Unfortunately it's not clear to me in the moment what's happening. Try the Assembly Binding Log Viewer; it might give you some extra details.

    No, you mustn't use x86 architecture, it wouldn't work.

  • Retha Profile Picture
    1,461 on at

    7140.ABV.jpg

    Unfortunately those of us on platform 12 with virtual machines seems not to have access to the assembly binding log viewer. I assume it is because we do not have administrator privileges on our VM's. As you can see from the above screenshot it is disabled and I cannot uncheck that option because it is greyed out.

  • Retha Profile Picture
    1,461 on at

    Looking at the exception's stack trace:

    ***

    StackTrace "   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)\r\n   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)\r\n   at Microsoft.Dynamics.Ax.Tms.Base.Bll.ReflectionFactory.CreateObject(String assemblyName, String type, ILabelProvider labelProvider, Object[] constructorParameters)" string

    ***

    It errors out on this line in TMSFwkRateEngingeFactory:

    TMSFwkIRateEngine rateEngine = ReflectionFactory::CreateObject(engineRecord.EngineAssembly, engineRecord.EngineType, TMSLabelProvider::construct()) with error labelId: @TRX2560 (Assembly '%1' found and loaded, but engine class  '%2' was not found.);

    Exception: + $exception {"Could not load file or assembly 'Dynamics.AX.ApplicationSuite.124.netmodule' or one of its dependencies. The system cannot find the file specified.":"Dynamics.AX.ApplicationSuite.124.netmodule"} System.IO.FileNotFoundException

    ReflectionFactory is on Microsoft.Dynamics.Ax.Tms.Base.Bll and in D365 I cannot look at the code in this dll. So I went to Ax2012 and choose edit on Microsoft.Dynamics.Ax.Tms.

    Looking at where the error code is in AX2012, it tells me that it finds the assempbly path with the assemblyname of our custom rate engine. If it didn't the error code would have been: @TRX2558

    The next step is to load from the assembly path which is good too, because its error code is @TRX2559:

    The error code I receive is when it tries to do a getType on the assembly.

    The exception error I get and the labelID (@TRX2560) for the error doesn't correspond

    We used to get the error that it cannot find the class, but that was because in AX2012 the calls that is called from the rate engine setup was "internal". When we changed it to "public" in D365, the error went away and changed to the above exception.

    I see in AX2012 we had also the warning about the mismatch between the processor architecture. so that can't be our problem.

  • Retha Profile Picture
    1,461 on at

    I started over with one of our rate engines, following the steps of the Microsoft document almost to the letter ;) Close to the bottom it says that in the development environment one needs to copy the DLL that is generated to the <packageLocaldirectory>\ApplicationSuite\Bin. I did that and I'm not getting the subject line error anymore.  It has an error inside the class in the C# class library but at least it is getting that far now. We were trying to run the DLLs from where it is generated in the bin directory under the custom model. The DLLs are generated inside our custom model for the rate engines which have the ApplicationSuite checked off when the model was created. So I don't really know why it can't run from the bin directory in the custom model. Regular custom extensions are being picked up where they are saved under the custom model directory structure. Anyways, it looks like we are one step closer to get the rate engines to work. With Ax2012 C# classes that moved into X++ classes in D365, it is clearly not as easy as to copy and paste code from the one version into the next and hope it will work after replacing the C# class names with the X++ class names where applicable. Would have loved that, but unfortunately not.

  • Community Member Profile Picture
    on at

    hi,

     iam also facing same problem of engine dll is found, but engine class  not  found..

    i copied dll in ApplicationSuite/bin also.

    Did you find any resolution?

    thanks

    Nitish Dikshit

  • Retha Profile Picture
    1,461 on at

    I got past the engine class not found. Did you make sure your class name in your visual studio project has the same name as the Engine class in your rate engine setup? Remember C# is case sensitive, so you shouldn't just look that the spelling is correct, you should also make sure your capital letters and small letters are the same.

  • Community Member Profile Picture
    on at

    I am also stuck at the same step. Can't seem to make it work.

    My exeption,

    Microsoft.Dynamics.Ax.Tms.Base.Utility.TMSException: TMSException: Error RateShopBroker ---> Microsoft.Dynamics.Ax.Tms.Base.Utility.TMSException: TMSEngineSetupException: Assembly 'TestTMSEngines.dll' found and loaded, but engine class 'TestTMSEngines.SampleRatingEngine' was not found. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Dynamics.AX.ApplicationSuite.124.netmodule' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

    I followed all the steps from Mircosoft's blog regarding creating a new TMS engine. It feels like something is missing there.

    I also copied the DLL that is created to <packageLocaldirectory>\ApplicationSuite\Bin. But, it didn't fix the problem for me.

    My version is 7.3 with PU12.

    Any help would be much appreciated in resolving this issue.

    Thanks,

    Malik

  • Community Member Profile Picture
    on at

    Another interesting observation is that when I build the C# project just like mentioned in the Microsoft blog for creating a new TMS engine, I don't get any error's.

    However, when I did a Full build(Selecting all packages) on my dev environment, I get these following errors,

    Severity Code Description Project File Line Suppression State

    Error CS0534 'SampleRatingEngine' does not implement inherited abstract member 'BaseRateEngine.rate(TmsTransactionFacade, XElement, string)' TestTMSEngines C:\Users\Useracb4806e2fd\Documents\Visual Studio 2015\Projects\TMSTestEngine\TestTMSEngines\SampleRatingEngine.cs 9 Active

    Error CS0115 'SampleRatingEngine.rate(TmsTransactionFacade, XElement, string)': no suitable method found to override TestTMSEngines C:\Users\Useracb4806e2fd\Documents\Visual Studio 2015\Projects\TMSTestEngine\TestTMSEngines\SampleRatingEngine.cs 11 Active

    Error CS0246 The type or namespace name 'TmsTransactionFacade' could not be found (are you missing a using directive or an assembly reference?) TestTMSEngines C:\Users\Useracb4806e2fd\Documents\Visual Studio 2015\Projects\TMSTestEngine\TestTMSEngines\SampleRatingEngine.cs 11 Active

    Any help would be much appreciated.

    Thanks,

    Malik

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans