Compile error: Microsoft.Office.Interop.Excel…
A few months ago I wrote a post on how to convert Excel documents to PDF with X++. Well, that piece of code made it into production! 🙂 But I just notice it does not necessarily compile with Ax Build. 🙁
The xlApp declaration does not compile because Excel is not installed on the server and AX build can only be completed on the server. If you compile this same piece of code in the AOT on a server that has Excel installed, it compiles without a problem.
- Install Excel on the server. I am not sure if this will allow AX Build to compile the code, but at least you can then open the AOT after AX build on the server and compile like I described here.
- Since I could not install Excel on the server, I did the following:
- Compile with AX Build on the server.
- If you have a compile error related to Microsoft.Office.Interop.Excel, start the server and open the AOT on a terminal server that has Excel installed.
- Compile the code with normal F7 compile.
- Compile the CIL on the terminal server.
Hope that helps! Let me know in the comments if you know of a better way to solve this.