Excel COM Interop - tlbimp vs primary WrapperTool

I am trying to add a Microsoft Excel 11.0 ActiveX Object Library to my .NET project. It works fine on my computer, but when I check my code, it doesn't work on my colleague. Corrected it, and it broke mine. When adding namespaces are different between our machines.

It turns out that the difference is that when you add a link, it uses it tlbimpas a WrapperTool, but for it it makes a link primary.

How do I get this to work the same for both of us? His car doesn't like the imported interop tlbimp, and I don't like the interaction primary.

+5
source share
2 answers

we had a similar problem and the "tlbimp" option worked on all computers.

My (imperfect) understanding: .NET uses wrapper assemblies to access COM components. If you specify "primary", you are using the existing pre-created "primary interaction assembly". According to http://msdn.microsoft.com/en-us/library/hfac4fky.aspx , "primary interaction assemblies are provided by the same publisher as the type library they describe." If using "primary" does not work for you, this assembly does not exist on your computer.

"tlbimp" ( , ), , . , . VS2003 ( KB). COM- Visual Studio.NET 2 (SP2) Windows XP , , VS.

, "Primary Interop Assemblies" , interop Excel , .

, .

+4

, registy:

HKEY_CLASSES_ROOT\TypeLib {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}\2.4

, :

: PrimaryInteropAssemblyName
: , = 12.0.0.0, = , PublicKeyToken = 71e9bce111e9429c

0

All Articles