简体   繁体   English

.net组件安装程序,用于COM互操作

[英].net component installer for COM interop

I have a .net component that will be called by unmanaged code. 我有一个.net组件,它将由非托管代码调用。 I want to create an installer for the .net component that will in one step.. 我想为.net组件创建一个安装程序。

-install it to the desired directory -generate the tlb file -run the regasm command -将其安装到所需目录-生成tlb文件-运行regasm命令

The deployers of this component dont have knowledge of the .net framework. 该组件的部署者不了解.net框架。

Any ideas? 有任何想法吗?

Thanks. 谢谢。

The type library only needs to be deployed if you want your client to use the component themselves when they write their own code using your COM server. 仅当您希望客户端使用COM服务器编写自己的代码时,让客户端自己使用组件时,才需要部署类型库。 That's unlikely given your description of their skills. 考虑到您对他们的技能的描述,这不太可能。 If required anyway, you are better off simply deploying the .tlb yourself instead of auto-generating it during install. 无论如何,如果您需要,最好直接自己部署.tlb,而不是在安装过程中自动生成.tlb。

Your client won't have Regasm.exe on their machine, it is only available in the Windows SDK. 您的客户端在其计算机上将没有Regasm.exe,仅在Windows SDK中可用。 Nevertheless, registering ComVisible components is a standard capability of MSI. 但是,注册ComVisible组件是MSI的标准功能。 You can create your own installer that registers the component with a Visual Studio Setup project. 您可以创建自己的安装程序,以在Visual Studio安装程序项目中注册组件。 Set the Register property to "vsdrpCOM". 将注册属性设置为“ vsdrpCOM”。

It's been a while but I think something like this would work: 已经有一段时间了,但是我认为这样可以工作:

Add an Install.Installer class to your component, override it's Install and Uninstall methods and use RegisterAssembly to register the Assembly . 在您的组件中添加一个Install.Installer类,覆盖它的InstallUninstall方法,并使用RegisterAssembly注册Assembly
Then create a Visual Studio setup project and add a custom action to run your Installer methods during the setup. 然后创建一个Visual Studio安装项目,并添加一个自定义操作以在安装过程中运行Installer方法。

Actually, here's a thread discussing just this and there's a comprehensive answer in there: http://www.dotnet247.com/247reference/msgs/18/90440.aspx 实际上,这里有一个线程正在讨论这个问题,并且那里有一个完整的答案: http : //www.dotnet247.com/247reference/msgs/18/90440.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM