How do I specify the manifest for side-by-side assemblies in my header file?
- by sep
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\winsxscd 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?