以及何时需要重新引用Tlb

以及何时需要重新引用Tlb

本文介绍了发行新版本的Tlb,以及何时需要重新引用Tlb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#dll,并使用regasm生成了一个tlb。我已经给使用该tlb的用户提供了一个实用电子表格。每当我们发布新版本的应用程序时,tlb都会取消注册(并使用regasm.exe进行注册)。

I have a C# dll and generarted a tlb using regasm. I have given a utility spreadsheet to the users which uses this tlb. The tlb is unregistered and registered (using regasm.exe) everytime a new version of our application is released.

但是,有时,一个新版本,它抛出 ActiveX组件无法创建实例错误,恰好在我创建类型对象的代码行上。我只是通过删除并添加回tlb参考来解决此问题。 (在vba模式下,工具-参考-取消选中tlb-save-,然后再次添加)。但是,这很痛苦,因为我无法为所有用户执行此操作。

However, at times, when the user is using the spreadsheet after a new release, it throws a 'activex component cannot create instance' error, exactly on the line of code where I create an object of a type. I fix this just by, removing and adding the tlb reference back. (In vba mode-tools-reference-uncheck the tlb-save-and again add). However this is painful since I cannot do this for all users.

我做了几次测试来复制该场景。就像更改dll的版本号并重新注册一样,向接口添加新方法并重新注册。但是在所有情况下,电子表格都可以正常工作,而不必删除并重新添加tlb引用。

I did several tests to replicate the scenario. Like changing the version number of dll and re-registering, adding new methods to interfaces and re-registering. But in all the cases, the spreadsheet works fine without having to remove and re-add the tlb reference.

因此,我很困惑tlb可能出现的情况必须在电子表格中重新添加以作为参考,这可能是什么原因。感谢您的帮助。

So, I am confused what could be the scenario where the tlb has to be re-added as reference in the spreadsheets and what could be the probable cause of this. Any help is appreciated.

谢谢,
玛尼

推荐答案

该问题很可能是由于类型库的UUID更改并且VBA中的引用变得无效而引起的。

The problem is most likely caused by the fact that UUID of the type library changes and the reference in VBA becomes invalid.

1)那边有一个人在写一个!

1) There a guy over there who wrote a VBA program to add TLB references and delete invalid ones!

2)这可能与您先卸载旧版本然后安装新版本有关。 提到了相反的顺序。 VBA可能有一些逻辑来自动更新它们,而这些逻辑只能与M $家伙想到的更新顺序一起使用。

另一种可能性是Excel是

2) This may be related to the fact you uninstall the old version first and then install the new one. RegAsm's manual mentions the reverse order. There's a possibility VBA has some logic to update them automagically that would only work with the update order that M$ guys had in mind.
Another possibility is that Excel was running during the update so it did not update its reference list when it was supposed to.

3)为了进一步诊断问题,我将使用procmon.exe。在注册表中会查询有关COM的所有内容,因此,如果出现错误,您可能会碰到该应用无法找到某些UUID密钥的地方。

3) To diagnose the problem further, I'd use procmon.exe. Everything about COM is looked up in the registry so in case of errors, you'll probably bump into the app's inability to find some UUID key.

这篇关于发行新版本的Tlb,以及何时需要重新引用Tlb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 20:43