部署Excel UDF [英] Deploying an Excel UDF

查看:173
本文介绍了部署Excel UDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel UDF调用Web服务。 UDF代码是一个自动化插件代码,它是一个C#类库,并为其创建了一个安装程序。当我运行设置,没有引用特定的插件代码出现在toos - > addins - >自动化插件列表中的excel和函数不apepar在公式栏中。我正在使用VS 2008和Excel 2003。



我在这里遗漏了什么?我应该定义Excel从哪里选择dll的路径,以便它指向从udf代码生成的dll?还是有什么安全问题需要照顾?客户端机器的安全级别设置为完全信任,但是加载项不会出现在列表中。



我在这里缺少一些东西?

解决方案

这是因为安装自动化加载项需要在注册表中创建自定义CLSID {GUID} \Programmable一个自动化加载项通常通过包含标记为 ComRegisterFunctionAttribute ComUnregisterFunctionAttribute 在你的类。当您在程序集上运行RegAsm时,这些类将被注册。



然而,使用Visual Studio安装程序包时,静默地忽略了ComRegisterFunctionAttribute和ComUnregisterFunctionAttribute。这是因为安装程序使用/ regfile开关运行RegAsm,以生成包含所有必需的注册表项的.reg文件。当.msi包在客户端站点运行时,这个.reg文件被使用。问题是当RegAsm通过/ regfile开关运行时,生成的.reg文件不包含由用户定义的寄存器功能(例如标记为ComRegisterFunctionAttribute和ComUnregisterFunctionAttribute的那些)的任何注册表更新。



因此,您的自定义CLSID {GUID} \Programmable注册表项未被创建,因此自动化加载项列表中未显示自动化加载项。



为了弥补这种情况,您必须通过其他方式创建自己的CLSID {GUID} \Programmable条目。通过使用注册表编辑器来实现此目的是最简单的方法安装程序包的部分。



正确处理自动化加载项的安装程序包的所有步骤有点复杂。幸运的是,我有一个一步一步的解释,如何做到这一点(以及更详细的描述为什么发生)作为答案的问题:如何获取用于Excel编写的COM服务器VB.NET安装并注册在自动化服务器列表中



希望这有帮助!




I have an excel UDF that calls a web service . The UDF code is an automation addin code which is a C# class library and I created an installer for it. When I run the set up, no reference to the particular addin code appears in the toos-->addins-->automation addins list of excel and the function does not apepar in the formula bar. I am using VS 2008 and Excel 2003.

Am I missing something here ? Should I define the path that Excel has to pick the dll from to something so that it points to the dll generated from the udf code? Or is there any security issues that has to be taken care of ? The client machine has the security levels set to Full Trust yet the addin does not appear in the list.

Am I missing something here ?

解决方案

This occurs because installing an automation add-in requires that a custom "CLSID{GUID}\Programmable" entry be made in the registry, which, when creating an automation add-in, is normally handled by including methods marked with the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute within your class. These classes are then registered when you run RegAsm on your assembly.

When using a Visual Studio Setup Package, however, the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute are quietly ignored. This occurs because the Setup Project runs RegAsm using the /regfile switch in order to generate a .reg file containing all of the required registry keys. It is this .reg file that is then utilized when the .msi package is run at the client site. The problem is that when RegAsm runs via the /regfile switch, the resulting .reg file does not contain any registry updates made by user-defined register functions (e.g., those marked with the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute).

As a result, your custom "CLSID{GUID}\Programmable" registry entry is not being created and, therefore, your automation add-in is not showing up in the automation add-ins list.

To remedy this situation, you must create your own, custom "CLSID{GUID}\Programmable" entry via another means. It is easiest to do this by making use of the Registry Editor section of the Setup Package.

Correctly handling all the steps for a Setup Package for an automation add-in is somewhat complicated. Fortunately, I have a step-by-step explanation of how to do this (as well as a more detailed description of why this is occurring) as an answer to the question: How to get COM Server for Excel written in VB.NET installed and registered in Automation Servers list.

Hope this helps!

Mike

这篇关于部署Excel UDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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