Server 2003上的Word 2003插件安装

时间:2009-01-20 19:28:49

标签: c# ms-word ms-office vsto add-in

我已经把别人的东西递给了我。其中包括一个Word 2003加载项(VSTO 2005 SE,.NET 2.0),据报道它在2007年运行良好,但是我们的部署环境需要2003.它安装对Office 2003来说显然没问题 - 没有错误,显示出来在添加/删除 - 但工具栏在Word本身不可用。

据说这在某人的测试环境中运行良好,但我从未见过它在我们的共同开发环境中工作。我们有一个包含MSI和setup.exe的安装/部署项目。 (为了以防万一,我尝试在CAB中打包东西,我已经尝试过,因为安装前缀不明显,没有明显区别。)

MSI,setup.exe,右键单击在Visual Studio中安装setup / deploy项目,这些方法都没有报告错误 - 但这些方法都没有成功显示Server 2003上的Word 2003中的工具栏。但是,如果我在Winword.exe上指向Visual Studio进行调试并启动项目,则会显示加载项按钮。它继续出现在后来的独立客户初创公司。它仍可作为工具栏使用,直到我通过添加/删除或右键单击卸载或运行MSI并删除它来明确删除它。

所以现在我不知所措 - 通过在典型的安装/部署安装过程中没有发生的调试运行会发生什么?

编辑:好的,更新。为Word 2003创建了一个干净的VSTO 2005加载项,新的加载项名称,干净的平板。在Server 2003和XP Pro上,裸项目,处女注册表都会遇到相同的行为。我是XP上的本地管理员,我是2003年盒子上的域管理员。

2 个答案:

答案 0 :(得分:2)

以下是一些疑难解答问题:

  • 您正在开发什么样的插件?共享加载项还是VSTO?如果VSTO是哪个版本?
  • 您使用的操作系统是什么? Vista可能很棘手......
  • 检查注册表中加载项的LoadBehavior。您可以在

    中找到该值
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Word\Addins\<add-in class name>\
    

    HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\Word\Addins\<add-in classname>\
    

如果LoadBehavior的值为2,则在启动期间已禁用加载项。当Word无法实例化加载项时会发生这种情况,通常是因为加载项会抛出未处理的异常,或者更常见 - 因为加载项未正确注册。

您是否检查过目标系统上是否正确安装了VSTO运行时?

但是,即使您使用VSTO,对于Word,加载项仍然看起来像一个经典的COM加载项,它扩展了经典的IDTExtensibility2接口。此类加载项必须按以下方式注册:

  • 上面两个注册表项之一,告诉Word加载项的类名以及其他信息,如加载行为和描述
  • 加载项的类名必须在

    下注册
    HKEY_CLASSES_ROOT\<add-in classname>\CSLID
    
  • 必须在({xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}是HKEY_CLASSES_ROOT \\ CSLID下指定的组件的guid)下注册正确版本的COM组件:

    HKEY_CLASSES_ROOT\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    

以下两个链接也可以帮助您进一步缩小问题范围:

  

HOWTO: Troubleshooting Visual Studio and Office add-ins

     

Troubleshooting Outlook COM Addins – Using ProcMon

答案 1 :(得分:1)

编辑:加载项程序集的完全信任最终成为修复程序。似乎没有比完全信任更少的东西。

//

结束了与微软公开的门票,他们让我了解了VSTO_SUPPRESSDISPLAYALERTS:

http://msdn.microsoft.com/en-us/library/ms269003(VS.80).aspx

此值默认为1;将其设置为0会提供一个弹出对话框,但异常被隐藏。

仍在制定详细信息,我将继续更新此主题,但现在我们终于有了继续前进的基础:

Could not load file or assembly 'PrintTest2007, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)


************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'PrintTest2007, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'PrintTest2007, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
   at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
   at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline(Exception e, String basePath, String filePath)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadStartupAssembly(EntryPoint entryPoint, Dependency dependency, Dictionary`2 assembliesHash)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
   at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)