分类: 嵌入式
2010-09-19 15:46:57
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual studio Dean wrote: > tlbimp.exe c:\temp\comdlls\iboUtil.dll \out:Interop.iboUtil.dll > \strictref then > tlbimp.exe c:\temp\comdlls\iboProduct.dll \out:Interop.iboProduct.dll > \reference:Interop.iboUtil.dll \strictref > > This gives me the interops (i think), however when I try to use them, > the do not work. Your flags have backslashes. I presume you mean slashes. I'm doing a similar thing to create Excel interop assemblies manually. It's working for me. I'm using the /safearray flag, because I read somewhere that it might be helpful, although I'm not sure whether I really need it. When you say it doesn't work, what do you mean? -- Peter Gummer |
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual stu Hi Thanks for you rely and yes, i meant slashes for the arguments. I tried "sysarray" and that didn't seem to help any. I should clarify what my problem is. I have done some further testing and see that if I run: tlbimp.exe c:\temp\comdlls\iboContentManagement.dll it generates 13 interop dlls without prepending the "Interop." to the dll names like it does under Visual studio. When I use these as references to my ..NET assembly, all works fine. But what i really want is the names of the dlls interops to be the same as you would get if you generated them by adding a reference to it through Visual Studio. So the only thing I could think of was to use 14 tlbimp statements. Doing this seemed to create the interops, however when I include them via a ref to my .NET assembly, it does not work. thanks "Peter Gummer" wrote: > Dean wrote: > > > tlbimp.exe c:\temp\comdlls\iboUtil.dll \out:Interop.iboUtil.dll > > \strictref then > > tlbimp.exe c:\temp\comdlls\iboProduct.dll \out:Interop.iboProduct.dll > > \reference:Interop.iboUtil.dll \strictref > > > > This gives me the interops (i think), however when I try to use them, > > the do not work. > > Your flags have backslashes. I presume you mean slashes. > > I'm doing a similar thing to create interop assemblies manually. > It's working for me. > > I'm using the /safearray flag, because I read somewhere that it might > be helpful, although I'm not sure whether I really need it. > > When you say it doesn't work, what do you mean? > > -- Peter Gummer > |
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual stu Dean wrote: > Doing this seemed to create the interops, however when I include them > via a ref to my .NET assembly, it does not work. Ok, that's basically what you said in your first post. You still haven't told us what you mean by "it does not work". -- Peter Gummer |
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual stu Sorry about that. What doesn't work is after i create the Interops with the /out: flag I try to compile using them as references and the compile fails with errors saying it cannot find the interop namespace. For instance one of the com objects that gets created when I create a reference using visual studio on iboContactAdder.dll is Inter.iboUserSecurity.dll (as well as Interop.iboContactAdder.dll). When I run: tlimp ..\iboUserSecurity.dll /out:InteropiboUserSecurity.dll and then use that interop dll in the visual studio project instead of the Interop which would get created through VS, i get the error: error CS0246: The type or namespace name 'iboUserSecurity' could not be found (are you missing a using directive or an assembly reference?) if i delete the reference to this Interop.iboUserSecurity.dll and use the iboUserSecurity.dll created without the /out: flag or if I use the original Interop.iboUserSecurity.dll generated using the VS add referece from COM space, I do not get this error. (also, The size of all the three interop dlls are the same, but they don't compare bit for bit...) "Peter Gummer" wrote: > Dean wrote: > > > Doing this seemed to create the interops, however when I include them > > via a ref to my .NET assembly, it does not work. > > Ok, that's basically what you said in your first post. You still > haven't told us what you mean by "it does not work". > > -- Peter Gummer > |
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual stu Dean wrote: > error CS0246: The type or namespace name 'iboUserSecurity' could not > be found (are you missing a using directive or an assembly reference?) Is this the namespace that tlbimp has generated? Have you used Reflector or Ildasm to confirm that this is the namespace? Try secifying the namespace explicitly, with tlbimp's /namespace flag. This doesn't always work, however, if the type library forces the namespace to be something else. -- Peter Gummer |
#
| |||
| |||
Re: How to create Interop...dll's using tlbimp.exe like Visual stu Yes, that was it. The namespace was wrong. i was able to generate the interops without using visual studio. It turns out that when you have a COM dll named foocom.dll, visual studio creates a interop file called Interop.foocom.dll with a namespace of foocom. If you use tlbimp foocom.dll it creates a foocom.dll interop. If you use the /out: flag it also changes the namespace to the /out value. So in my case, I used: tlbimp /out:Interop.foocom.dll /namespace:foocom Since the above would generated about a dozen dependent interops, i had to run them all in order so I got the right names. I also used the /asmversion flag to manually update the version number so shield patch would update the thing. "Peter Gummer" wrote: > Dean wrote: > > > error CS0246: The type or namespace name 'iboUserSecurity' could not > > be found (are you missing a using directive or an assembly reference?) > > Is this the namespace that tlbimp has generated? Have you used > Reflector or Ildasm to confirm that this is the namespace? > > Try secifying the namespace explicitly, with tlbimp's /namespace flag. > This doesn't always work, however, if the type library forces the > namespace to be something else. > > -- Peter Gummer > |