views:

308

answers:

1

I am developing in Visual C++ 2008 using MSMQ. In Windows Vista, the application cannot locate the mqrt.dll which is found at C:\Windows\winsxs>cd x86_microsoft-windows-msmq-runtime-core_31bf3856ad364e35_6. 0.6002.18005_none_574cf1cdb624ee17\mqrt.dll.

The description of the manifest in WinSxS is:

<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" />

I added a #pragma comment into my header file:

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

The manifest is embedded into the exe using mt.exe. But it does not work. The error message in sxstrace is:

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.

I tried the following pragma, but WinSxS does not even try to resolve msmq (probably because of the versionScope attribute):

#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'\"")

What is the correct pragma to use?

A: 

I really don't know why it did not find the assembly. When I had trouble like this I went and got Process Monitor from SysInternals (now hosted at microsoft.com) and watched all file access into the WinSxS store.

iirc, manifest probing is/was done by a different process to the application process so don't filter on your own EXE's name.

Anyway the folder it was trying to look for was obviously different to the one that existed in my case that gave me a solid avenue to investigate.

Chris Becke