我使用的是Visual Studio2013。在我的程序中,我创建了一个Excel文档。它工作正常,但是当我尝试在构建服务器上构建此解决方案时,服务器抛出此异常:
Result:System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at AutomatedTest.AutoStatistic.AutoConvert(String pathOld, String pathNew, String pathLog, String pathToDocuments) in...
在这行上:
Application xlApp = new Application();
我不想在构建服务器上安装Visual Studio。我需要在构建服务器上安装什么,以便构建可以正确编译?
PS我的程序基于x86平台构建。
构建服务器(不是Visual Studio)缺少的是Excel。
但是完全不支持从Windows服务(如TFS Build)运行Office(请参阅KB 257757)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句