如何在VSTO项目中注册UDF / RTD [英] How to register UDF/RTD within VSTO project

查看:117
本文介绍了如何在VSTO项目中注册UDF / RTD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部



这是我的问题的后续活动此处



我的设置:




  • Visual Studio 10

  • 语言C#

  • Excel 2007 +

  • Windows XP +



我想实现的目标是:




  • 使用自定义功能区组件和自定义任务窗格为Excel创建VSTO加载项

  • 创建RTD服务器

  • 创建一些UDF来包装 = RTD()调用Excel用户

  • 让客户端通过ClickOnce安装来安装Addin



除了最后一个要求,我基本上完成了。我唯一的问题是在不使用 regasm.exe 的情况下,在目标计算机上注册RTD服务器和UDF。
我基本上希望客户确实单击一次然后忘掉它,尤其是因为有数百个潜在用户,而且这些用户都分布在整个世界范围内。



此外,由于它们在技术上并不精明,因此我不希望他们必须手动注册COM组件或类似的东西。



我不在乎UDF和RTD服务器是否是单独的项目,只要我可以通过ClickOnce将它们与VSTO插件一起包含并注册在一起即可。



我研究了免注册的COM,但是我一生都无法在VSTO插件中使用它。
我要做的是创建第二个项目(库类),尝试导出并注册以进行COM互操作,然后将其包含到我的主文件中项目并在那里使用它:无法编译(无法从程序集中嵌入互操作类型,因为它缺少'ImportedFromTypeLibAttribute'属性或'PrimaryInteropAssemblyAttribute'属性)还是不注册。



在互联网上有很多例子可以满足我的部分需求,但是对于我的全部需求却没有。

>

我在这里完全偏离轨道吗?有人可以指出正确的方向并提供一些示例代码/配置示例吗?



干杯,
Che

解决方案

使用在安装过程中运行RegAsm.exe的安装程序类完成的。请参阅:
如何使用Visual Studio 2008安装程序项目中的重注册方式注册.NET CCW



希望这有帮助,
Frank p>

All,

This is a follow up for my question here.

My setup:

  • Visual Studio 10
  • Language C#
  • Excel 2007+
  • Windows XP+

What I would like to achieve is this:

  • Create VSTO addin for Excel with a custom Ribbon component and a custom Task Pane
  • Create an RTD server
  • Create some UDF's that wrap the =RTD()-calls for the Excel users
  • Have the clients install the Addin through a ClickOnce installation

Apart from the last requirement, I am basically done. The only problem I have is to get the RTD server and the UDF's registered on the target machine without using regasm.exe. I basically want the client to indeed click once and then forget about it, especially since there are hundreds of potential users, all distributed geographically over the whole world.

Also, since they are not technically savvy, I do not want them to have to register COM components manually or anything like that.

I do not care if the UDF's and the RTD server are a separate project, as long as I can include and register them together with the VSTO addin via ClickOnce.

I looked into registration-free COM, but was not for the life of me able to get this to work in my VSTO addin. What I did was create a second project (a library class) and trying to export and register it for COM interop, then to include it into my 'main' project and use it there: it either would not compile (Cannot embed interop types from assembly [...] because it is missing either the 'ImportedFromTypeLibAttribute' attribute or the 'PrimaryInteropAssemblyAttribute' attribute) or not register.

There are loads and loads of examples on the internet for the separate parts of my requirements, but nothing for the full monty.

Am I completely off track here? Can somebody please point me in the right direction and ideally offer some example code/configuration?

Cheers, Che

解决方案

This can be accomplished using an installer class that runs RegAsm.exe during installation. See: How to register a .NET CCW with regasm from a Visual Studio 2008 Setup project

Hope this helps, Frank

这篇关于如何在VSTO项目中注册UDF / RTD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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