سؤال

لدي 2 .NET DLL's التي أعرضها على COM باستخدام Regasm. من أجل تبسيط الإشارة داخل عميل COM ، أود أن أجعلها في ملف واحد.

لقد حاولت تحويل كلا الملفين إلى IDL ثم نسخ محتويات قسم المكتبة من أحدهما إلى الآخر ثم التجميع مرة أخرى إلى .tlb مع MIDL. يعمل هذا بشكل جيد بالنسبة لـ typedefs داخل IDL الثاني ، لكن يبدو أنه يفشل عندما يتعلق الأمر بالواجهات التي قمت بنسخها. لقد نسخت في.

أردت أن أتأكد قبل أن أقضي وقتًا طويلاً في هذا الأمر ، وأنه من الممكن بالفعل أن أتعامل مع IDL بهذه الطريقة.

هل كانت مفيدة؟

المحلول 3

Ok so it turns out that the issues I was experiencing were not related to merging the idl's.

If you wish to merge to idl's you can do so by simply copying the content of a library section in one idl into another. Then run midl on the merged file to turn it into a tlb.

نصائح أخرى

Could you use ILMerge to first combine the .NET assemblies and then use REGASM on the resulting assembly?

ILMerge is a utility for merging multiple .NET assemblies into a single .NET assembly. It works on executables and DLLs alike and comes with several options for controlling the processing and format of the output.

I don't see an obvious way this would fail. You said you merged the library sections but you didn't say you copy-pasted the interface declarations from the other .idl. That would be an obvious, but unlikely, explanation.

One failure mode is when the client app uses the type library to marshal interface pointers across apartment boundaries or out-of-process. That however requires registry keys in HKCR\Interfaces. .NET doesn't create them, you'd have to do that yourself. You'd know if you did, not much of an explanation either.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top