Excel VSTO拒绝在特定计算机上加载



我们有用于Excel的VSTO插件,它在除一个系统外的所有系统上都能工作,我从问题机器中得到以下错误。

加载这个Excel扩展似乎有问题,而且不知道为什么会在特定系统上发生这种情况。问题机器的错误如下,

System.Runtime.InteropServices.COMException (0x800A03EC): Cannot insert object.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Shapes.AddOLEObject(Object ClassType, Object Filename, Object Link, Object DisplayAsIcon, Object IconFileName, Object IconIndex, Object IconLabel, Object Left, Object Top, Object Width, Object Height)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.CreateWrapperAndGetCookie(String name, Double left, Double top, Double width, Double height, Boolean anchor, _OLEObject& outObject)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.InternalAddOtherControl(Control control, Double left, Double top, Double width, Double height, String name, Boolean anchor)
at Microsoft.Office.Tools.Excel.ControlCollectionImpl.AddControl(Control control, Range range, String name)
at TechnicalCalculation.Sheet1.LoadSchedulerUserControl()
at TechnicalCalculation.ThisWorkbook.InitializeService()
at TechnicalCalculation.ThisWorkbook.ThisWorkbook_Startup(Object sender, EventArgs e)
at Microsoft.Office.Tools.Excel.WorkbookImpl.OnStartup()
at Microsoft.Office.Tools.Excel.WorkbookImpl.WorkbookExtensionImpl.Microsoft.Office.Tools.EntryPoint.OnStartup()
at Microsoft.Office.Tools.Excel.WorkbookBase.OnStartup()
at TechnicalCalculation.ThisWorkbook.FinishInitialization()
at Microsoft.Office.Tools.Excel.WorkbookBase.Microsoft.Office.Tools.EntryPoint.FinishInitialization()
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.ExecutePhase(ExecutionPhases executionPhases)
at Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.ExecuteEntryPoints()

我们已经试过了,

  1. 尝试并实现任何已实现的依赖关系
  2. VSTO打包在一个安装文件中,我们已经卸载并重新安装了它
  3. VSTO,它可以发出日志,但在加载VSTO时不会发出日志。似乎在从VSTO执行任何代码之前,它都被限制为使用Excel加载

安装或卸载Office解决方案时,可以在Windows中使用事件查看器查看Visual Studio Tools for Office运行时捕获的异常消息。您可以使用事件记录器中的这些消息来解决安装和部署问题。在Office解决方案的事件日志文章中了解更多相关信息。

可以设置VSTO_SUPPRESSDISPLAYALERTS窗口环境变量,以便在加载VSTO加载项时启用详细的Outlook和VSTO(Visual Studio Tools for Office(错误消息。请参阅如何启用VSTO错误/显示警报?。

我找到了问题的解决方案,它在下面的链接中给出解决方案在最后一步给出,针对我的问题

最新更新