ComException when invoking a method of an Excel class on Chinese OS

We are running TeamCity Enterprise version 6.0.2 (build 15857) at our environment.
One agent runs on a Chinese Windows OS machine and Chinese Excel (Office 2007) while other agents run on English Windows OS and Excel.
The NUnit test which involves saving an Excel file (using Invoke call) runs on the English agents but does not run on the Chinese agent with the following error:

the exception is thrown at this point in code:
typeof(Microsoft.Office.Interop.Excel.Workbook).InvokeMember("SaveAs", BindingFlags.InvokeMethod, ...

Test(s) failed. System.Runtime.InteropServices.COMException :类 Workbook 的 SaveAs 方法无效
Translated: System.Runtime.InteropServices.COMException: Unable to get the SaveAs property of the Workbook class

Strange is here that we can run on the same Chinese agent the same test using nunit-console.exe without problem. But not if the same command is executed by the TeamCity agent.

Any help is appreciated.
Diego

2 comments
Comment actions Permalink

Try to run the agent interactivelly within your user session by agent.bat start.

The thing is Microsoft Office automation is not officially supported to work under services. See KB257757 for details.
Also here is a related thread in Microsoft forums.

Running the agent service under an account may help also, but we cannot officially support this approach either.

Michael

0
Comment actions Permalink

Thanks a lot for the fast and correct answer!
Now the Chinese agent is able to run those tests :-)

ps: I marked the answer erroneously as helpful instead of correct. So sorry for your 2 points.
Regards,
Diego

0

Please sign in to leave a comment.