سؤال

لقد قمت ببناء تطبيق عميل COM يستخدم DLLs خادم COM؛ أريد تشغيل هذا التطبيق بدون تسجيل COM - أي: Winsxs / .manifests

أحصل على رسالة (... من المتوقع تقريبا ...) رسالة "فئة غير مسجلة" عندما أحاول إنشاء مثيل لكائن COM الخاص بي من تطبيق عميل الخاص بي.

لقد نجحت بالفعل هذا النوع من التكوين من قبل ولكن لا يمكنني معرفة سبب فشل هذا واحد.


هنا عدد قليل من التفاصيل:

  • الوحدات التي لدي:
    • عميل MFC يعتمد على خوادم 2 COM (dll1.dll و dll2.dll)
    • خادم cll1.dll com يعتمد على dll2.dll
    • dll2.dll لا يوجد لديه اعتماد كوم

      كائنات com لدي:

      • في dll1.dll (. بلغة)

        - giveacodicetagpre.

        -

        • في dll2.dll

          - giveacodicetagpre.

          -

          • دعوة العميل

            - giveacodicetagpre.

            -

            • client.exe.2.manifest

              - giveacodicetagpre.

              -


              ليس لدي أي خطأ أثناء جيل سياق سياق SXS: - لا يوجد خطأ في سجل Windows (يجب أن يعني بناء جملة البيان الخاص بي) - لا يوجد خطأ تم اكتشافه بواسطة SXStrace (ينتهي السجل ب "معلومات": نجح جيل سياق التنشيط. "الرسالة ولا تحتوي على أي خطأ أو رسالة صاخبة؛ علاوة على ذلك، أرى أن بيضتي يتم تحميله بشكل صحيح)

              أي فكرة؟

              هل هناك طريقة لتصحيح SXS أعمق ذلك مع sxstrace؟ الحصول على قائمة فصول COM أو CLR المسجلة فعليا على سبيل المثال ؟؟؟

              شكرا لك من خلال التقدم

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

المحلول

There are usually - at least - two manifests involved when building the activation context for registration free COM.

There is the EXE manifest, that specifies its dependent assemblies, including the assembly containing the COM components, and there is the assembly manifest, describing the dll's, window classes, and COM objects in the assembly.

This Blog contains information about what the .2 means. Basically, when the system looks for a manifest, it looks for modulename.exe[.resid].manifest - In the case that resid is 1, it is omitted.

So, you are using MFC, which means DevStudio, which means that your project should already be configured to produce a RT_MANIFEST resource automatically with the c-runtime and common control 6 settings in it.

Visual Studio 2005 supports this syntax to merge dependentAssembly elements with your applications manifest without having to try and merge XML directly:

#pragma comment(linker, \
    "\"/manifestdependency:type='Win32' "\
    "name='client' "\
    "version='1.0.0.0' "\
    "processorArchitecture='*' "\
    "language='*'\"")

So, if you add that to a cpp or header in your .exe, and then save your client.exe.2.manifest as "client.manifest", you should be all systems go.

نصائح أخرى

The simple explanation is that the .manifest file isn't being used. Which is highly likely in this scenario, your .exe almost certainly already contains a manifest, embedded as a resource. Very common for a MFC app to enable visual styles. And for code compiled by the VS2005 or 2008 compilers which embeds a manifest to find the runtime DLLs.

To verify this, use File + Open + File and select the compiled .exe file. Look for the RT_MANIFEST node. If Windows finds such an embedded manifest it isn't going to continue looking for a file-based one. You need to merge your regfree COM entries into the embedded one. I wish I could give you a good MSDN Library link but the docs about manifests suck serious rock.

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