.NET Word 2003 加载项可以安装在 GAC 之外吗? [英] Can a .NET Word 2003 add-in be installed outside of the GAC?

查看:22
本文介绍了.NET Word 2003 加载项可以安装在 GAC 之外吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个 Word 插件组件和一个用于安装该组件的 Visual Studio 安装项目.

I've created a Word add-in component, and a visual studio setup project to install the component.

在安装了 Office 2003 的干净机器上,似乎无法在 Word 中加载加载项组件.

On a clean machine with Office 2003 installed, it does not seem to be possible to get the add-in component to load in Word.

谷歌搜索这个问题表明这是因为程序集不受信任.我使用命令行工具完全信任程序集:

Googling the issue suggests that this is because the assembly is not trusted. I gave the assembly full trust using the command line tool:

caspol -af AssemblyName.dll

这没有任何区别,组件仍未加载到 Word 中.caspol 打印出一条消息因为所有 GAC 程序集总是得到完全信任,所以完全信任列表是不更有意义.您应该安装任何用于安全性的程序集GAC 中的政策,以确保他们受到信任"

This makes no difference and the compenent is still not loaded in Word. caspol prints out a message "Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted"

更改安装程序以将程序集放在 GAC 中可以使其在 Word 中正确加载.但是该组件将来可能必须使用公共程序集,在我们的其他 .NET 应用程序之间共享,并且将这些库添加到 GAC 是不可取的.

Changing the installer to put the assembly in the GAC allows it to correctly load in Word. But the component may have to use common assemblies in the future, shared between our other .NET applications, and adding these libraries to the GAC would be undesirable.

有谁知道如何设置安全性以允许在 GAC 外部安装时加载组件?

Does anyone know how to set the security to allow the component to be loaded when installed outside the GAC?

推荐答案

您可以手动运行以下命令来设置安全性,以允许 Word 从 GAC 外部运行程序集.这将创建一个具有完全信任的新组,从而允许程序集运行.

You can manually run the following command to set security to allow the word to run the assembly from outside the GAC. This creates a new group with full trust which is what allows the assembly to run.

caspol.exe -u -addgroup All_Code -url "*"  FullTrust -n AssemblyName.dll

Microsoft 在以下站点为安装程序提供示例自定义操作链接到MSDN,这将允许您将此命令作为安装程序自定义操作包含在内.

Microsoft have an example custom action for an installer at the following site link to MSDN, which will allow you to include this command as an installer custom action.

这篇关于.NET Word 2003 加载项可以安装在 GAC 之外吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆