We are working on a .NET Core
solution where the request comes in to do some communications with Dynamics AX 2009
.
In AX we have some static methods that we need to call from within our solution. In other .NET Framework
solutions we used the Business Connector that gets installed with AX. This was always working fine but now in the .NET Core
solution we got exception during Autofac resolving:
Autofac.Core.DependencyResolutionException:
An exception was thrown while invoking the constructor 'Void
.ctor(Core.Configuration.AppConfig, Core.Logging.ILogger)' on type
'AxConnectionProvider'. ---> System.BadImageFormatException: Could not load file or assembly
'Microsoft.Dynamics.BusinessConnectorNet, Version=5.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'. An attempt was made to load a program with an incorrect format.
Which is correct because the Business Connector is not supported in .NET Core
.
But how can we solve this issue in order to work with AX 2009 and call static methods from within our .NET Core
solution?
We have a .NET Standard
library where we included all AX code and where we included the Business Connector dll as a reference.