C# 在Server2003上安装Word 2003插件

C# 在Server2003上安装Word 2003插件,c#,ms-word,ms-office,vsto,add-in,C#,Ms Word,Ms Office,Vsto,Add In,我收到了别人的一堆东西。在这些项目中,有一个Word 2003插件(VSTO 2005 SE,.NET 2.0),据报道它在2007年工作得很好,但我们的部署环境需要2003年。对于Office 2003,它的安装显然很好——没有错误,显示在“添加/删除”中——但是Word本身中没有工具栏 据推测,这在某人的测试环境中运行良好,但我从未见过它在我们的通用开发环境中运行。我们有一个带有MSI和setup.exe的安装/部署项目。(我试过在出租车里打包东西以防万一,我试过独立安装prereqs,没有

我收到了别人的一堆东西。在这些项目中,有一个Word 2003插件(VSTO 2005 SE,.NET 2.0),据报道它在2007年工作得很好,但我们的部署环境需要2003年。对于Office 2003,它的安装显然很好——没有错误,显示在“添加/删除”中——但是Word本身中没有工具栏

据推测,这在某人的测试环境中运行良好,但我从未见过它在我们的通用开发环境中运行。我们有一个带有MSI和setup.exe的安装/部署项目。(我试过在出租车里打包东西以防万一,我试过独立安装prereqs,没有明显区别。)

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

所以现在我不知所措了——在调试中运行会发生什么,而在典型的安装/部署安装过程中不会发生什么


编辑:好的,更新。为Word 2003创建了一个干净的VSTO 2005外接程序,新外接程序名为clean slate。在Server2003和XPPro上的裸体项目VirginRegistry也经历了同样的行为。我是XP上的本地管理员,我是2003框上的域管理员。

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

  • 您正在开发什么样的外接程序?共享加载项还是VSTO?如果选择哪个版本
  • 你在用什么操作系统?Vista可能很棘手
  • 在注册表中检查外接程序的加载行为。您可以在

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Word\Addins\<add-in class name>\
    
以下两个链接还可以帮助您进一步缩小问题范围:


编辑:外接程序程序集的完全信任最终成为修复程序。似乎没有什么比完全信任更让人失望的了

//

最后在微软开了一张罚单,他们教我如何使用VSTO\u SUPPRESSDISPLAYALERTS:

该值默认为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)

本网站仅用于编程问题。阅读常见问题解答。插件开发与编程非常相关。你说得很对——我完全误解了。我很抱歉。如前所述,VSTO(我认为——出于某种原因,这家伙还拥有共享加载项KB修补程序的prereq)和Server2003。不幸的是,LoadBehavior在工作时和不工作时没有任何区别。(感谢您指出本地用户,我想知道为什么!在本地计算机中。)抱歉,实际上加载行为可能在2和3之间变化,但任何一个值都不会产生差异。好的,它以3开头,然后在Word启动SAN加载项后,值变为2。有日志可以查吗?谢谢你提供的信息,还在挖掘。。。VSTO运行时看起来不错,重新安装只是以防万一。我不明白的是,为什么它在Visual Studio调试中运行良好,经过调试后,它可以独立运行,但在初始安装后不会独立运行。您是否尝试过删除(重命名)外接程序安装的所有相关注册表项,然后重新安装外接程序?可能是调试器在CLSID键下添加了另一个版本,这是一个令人困惑的词。
HKEY_CLASSES_ROOT\<add-in classname>\CSLID
HKEY_CLASSES_ROOT\CLSID\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
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)