
I have added ImageMagick assembly for .NET (MagickNET.dll) in References in Dynamics AX 2012 and executed some X++ code to convert image format and it worked fine.
Then I moved all the code to a method with RunOn property set to server as I dont want to run it on client side. Now, when I execute the same X++ code it gives me the following errors.
Assembly containing type MagickNet.Geometry is not referenced.
Object 'CLRObject' could not be created
Initially, during testing on client method, I placed .dll file in my .../Client/Bin folder and added reference from my AOT.
Next I placed it in .../Server/.../Bin folder and added reference from my server's AOT and then tested the method with RunOn property set to server but it is not working and gave me the above mentioned errors.
Please help me as I have been working around this issue for a week and could not get any solution.
*This post is locked for comments
I have the same question (0)Here are two things you should try.
If you copied/pasted the .NET assembly from the client\bin to the server\..\bin directory, the original permissions could have been retained and the AOS server's security context could not have permissions to the .NET dll. Reset the permissions on it to inherited.
Instancing a .NET object on the server tier requires asserting Code Access Security permissions, like this.
permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();
In fact many things that work fine on the client require using CAS permissions, such a file access and direct SQL statement execution. .NET is definitely one of those things.
Good luck!