代码之家  ›  专栏  ›  技术社区  ›  sep

如何在头文件中指定并行程序集的清单?

  •  0
  • sep  · 技术社区  · 15 年前

    我用MMSQ在Visual C++ 2008中开发。在Windows Vista中,应用程序找不到mqrt.dll可在C:\Windows\winsxs>cd x86\u microsoft-Windows-msmq-runtime-core_31bf3856ad364e35_6找到。

    WinSxS中清单的描述是:

    <assembly xmlns="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0" description="MSMQ core runtime component." displayName="MSMQ Core runtime component" company="Microsoft" copyright="Copyright (c) Microsoft Corporation. All Rights Reserved." creationTimeStamp="2005-03-11T01:47:18" lastUpdateTimeStamp="2005-03-11T01:48:59">
      <assemblyIdentity name="Microsoft-Windows-msmq-runtime-core" version="6.0.6002.18005" processorArchitecture="x86" language="neutral" buildType="release" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" />
    

    我在头文件中添加了一个#pragma注释:

    #pragma comment(linker, "\"/manifestdependency:name='Microsoft-Windows-msmq-runtime-core' version='6.0.6002.18005' processorArchitecture='x86' publicKeyToken='31bf3856ad364e35' language='neutral'\"")
    

    使用将清单嵌入到exe中mt.exe文件. 但它不起作用。sxstrace中的错误消息是:

    INFO: Resolving reference Microsoft-Windows-msmq-runtime-core,processorArchitecture="x86",publicKeyToken="31bf3856ad364e35",version="6.0.6002.18005".
        INFO: Resolving reference for ProcessorArchitecture x86.
            INFO: Resolving reference for culture Neutral.
                INFO: Applying Binding Policy.
                    INFO: No publisher policy found.
                    INFO: No binding policy redirect found.
                INFO: Begin assembly probing.
                    INFO: Did not find the assembly in WinSxS.
                    INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft-Windows-msmq-runtime-core\6.0.6002.18005__31bf3856ad364e35\Microsoft-Windows-msmq-runtime-core.DLL.
                    INFO: Attempt to probe manifest at c:\qt\datamon\bin\Microsoft-Windows-msmq-runtime-core.DLL.
                    INFO: Attempt to probe manifest at c:\qt\datamon\bin\Microsoft-Windows-msmq-runtime-core.MANIFEST.
                    INFO: Attempt to probe manifest at c:\qt\datamon\bin\Microsoft-Windows-msmq-runtime-core\Microsoft-Windows-msmq-runtime-core.DLL.
                    INFO: Attempt to probe manifest at c:\qt\datamon\bin\Microsoft-Windows-msmq-runtime-core\Microsoft-Windows-msmq-runtime-core.MANIFEST.
                    INFO: Did not find manifest for culture Neutral.
                INFO: End assembly probing.
        ERROR: Cannot resolve reference Microsoft-Windows-msmq-runtime-core,processorArchitecture="x86",publicKeyToken="31bf3856ad364e35",version="6.0.6002.18005".
    ERROR: Activation Context generation failed.
    

    #pragma comment(linker, "\"/manifestdependency:name='Microsoft-Windows-msmq-runtime-core' version='6.0.6002.18005' processorArchitecture='x86' publicKeyToken='31bf3856ad364e35' language='neutral' buildType='release' versionScope='nonSxS'\"")
    

    要使用的正确pragma是什么?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Chris Becke    15 年前

    我真不知道它为什么没有找到集会。当我遇到这样的麻烦时 Process Monitor

    iirc,清单探测是由与应用程序进程不同的进程完成的,所以不要根据自己的EXE名称进行筛选。

    不管怎么说,它试图寻找的文件夹明显不同于我案件中的文件夹,它给了我一个可靠的调查途径。