Microsoft Dynamics (Axapta) 2012 R1.
So, we have an interface includes a C# project, and for some reason it’s periodically giving us errors. One theory I have is that this is occurring when I import code or copy a database but don’t have the I have the Microsoft Dynamics AX Configuration Utility set to the environment that the data is being copied into. I may be wrong. But even without the root cause, I can describe the steps I’m taking to correct them.
Here are some of the errors:

“Assembly containing type <C# class name> is not referenced

CIL generation: Severe Warning: .NET type <C# class> is not found during IL generation. <AX class that references C# class> will throw an exception at run time.

System.IO.FileNotFoundException: Could not load file or assembly <c# class> … or one of its dependencies. The system cannot find the file specified.
Basically these errors mean that your AX code can no longer recognize your C# code. Depending on which errors you have, you may not need to do all of the things on this list:
- Ensure that you’re running Axapta as an administrator.
- Go into the Microsoft Dynamics AX Configuration Utility and ensure that you have it set to the correct environment. This utility is on the Terminal Server
- Go into the Microsoft Dynamics AX Server configuration Utility and ensure that you have ‘Enable the hot-swapping of assemblies for each development session’ checkbox checked. This utility is on the environment server (naxaospp for dev).
- Edit the C# project (this will bring up visual studio).
- Rebuild the C# project.
- Deploy the C# project.
- In Axapta, find the AX class that is accessing the C# class. Right click on it and select Compile forward.
- Generate incremental.
- If you get an error while generating incremental, then restart your environment service, then try steps 7 & 8 again.


