システム全体またはユーザー全体で登録されていない特定のバージョンの ActiveX コンポーネントを使用したいと考えています。マニフェスト ファイルを使用すると、すべてが期待どおりに機能します。ただし、埋め込みマニフェストは C++ クライアント コードに対してのみ機能します。
ここに依存宣言があります
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="MapWinGIS.ocx" version="4.9.1.0" />
</dependentAssembly>
</dependency>
SxStrace を使用すると、次のように表示されます
INFO: Parsing Manifest File C:\OSGeo4W\bin\TestApplication.exe.
INFO: Manifest Definition Identity is MyApplication.app,version="1.0.0.0".
INFO: Reference: MapWinGIS.ocx,type="win32",version="4.9.1.0"
INFO: Resolving reference MapWinGIS.ocx,type="win32",version="4.9.1.0".
INFO: Resolving reference for ProcessorArchitecture MapWinGIS.ocx,type="win32",version="4.9.1.0".
INFO: Resolving reference for culture Neutral.
INFO: Applying Binding Policy.
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:\OSGeo4W\bin\MapWinGIS.ocx.DLL.
INFO: Attempt to probe manifest at C:\OSGeo4W\bin\MapWinGIS.ocx.MANIFEST.
INFO: Attempt to probe manifest at C:\OSGeo4W\bin\MapWinGIS.ocx\MapWinGIS.ocx.DLL.
INFO: Attempt to probe manifest at C:\OSGeo4W\bin\MapWinGIS.ocx\MapWinGIS.ocx.MANIFEST.
INFO: Did not find manifest for culture Neutral.
INFO: End assembly probing.
ERROR: Cannot resolve reference MapWinGIS.ocx,type="win32",version="4.9.1.0".
ERROR: Activation Context generation failed.
どうやら、何が何でもDLLが必要なようです。問題は、AxImp から取得した DLL にマニフェストが埋め込まれていないことです。埋め込みマニフェストを使用する良い方法はありますか? AxImp から取得した DLL に mt を埋め込むことができるように感じますが、それはハックのようです。
PS ocx を dll に名前変更することが良いアプローチであるかどうかはわかりません。AxImp も COM 用に同じ名前の DLL を生成し、COM CLR プロキシの出力名を明示的に提供するフラグがないように見えます。