When developing VS studio components in AX2012 You might experience the following error trying to run the code:
When You build your vs project You will have to decide whether to publish to either client or server or maybe even both. This is where You need to keep in mind, that the server is quite certain to run as a 64 bit application where the client runs in 32 bit mode. So when building your dll for either server or client, You need specifically target the right cpu architecture. If You are deploying to both client and server You need to build using the “AnyCPU” option.
Using the AnyCPU option will cause a warning when compilling – just ignore it…
If You need to test your component on both server and client an easy way could be to:
- create a class with a new method and instantiate your dll in that method.
- Set the class to run on client
- Create a job and run the method.
- Switch the class properties to run on server and perform the same test again.
- If no errors occur You are good to go…