2010-07-07 52 views
4

背景。我有一個用C#編寫的COM Wrapper程序集,叫做ComWrapper.dll,Visual Basic 6程序叫做Project1.exe。我添加了Project1.exe.manifest文件(其內容如下所示),並且出現一個錯誤消息,指出「應用程序啓動失敗,因爲它的並排配置不正確。這是我的配置。免費註冊COM Interop:應用程序無法啓動,因爲其並排配置不正確

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
    <assemblyIdentity type="win32" 
        name="Project1.exe" 
        version="1.0.0.0" 
        processorArchitecture="x86" /> 
    <dependency> 
    <dependentAssembly> 
     <assemblyIdentity name="ComWrapper" version="1.0.0.0" processorArchitecture="msil"></assemblyIdentity> 
     <clrClass clsid="{3ac3d04e-1f83-4a27-b516-95e38126685d}" progid="MyComObjectNamespace.myclass" threadingModel="Both" name="MyComObjectNamespace.myclass" runtimeVersion=""></clrClass> 
     <file name="ComWrapper.dll" hashalg="SHA1"></file> 
     <dependency> 
     <dependentAssembly> 
      <assemblyIdentity name="mscorlib" version="2.0.0.0" publicKeyToken="b77a5c561934e089"></assemblyIdentity> 
     </dependentAssembly> 
     </dependency> 
    </dependentAssembly> 
    </dependency> 
</assembly> 

任何幫助將非常感激。

回答

5

您需要使用sxstrace.exe確定錯誤的真正原因,因爲(完成)錯誤消息文本告訴你這樣做。這就是它是錯誤的:

INFO: Parsing Manifest File

C:\Temp\sxs\Project1.exe.Manifest.

INFO: Manifest Definition Identity is Project1.exe,processorArchitecture="x86",type="win32",version="1.0.0.0".

INFO: Reference: ComWrapper,processorArchitecture="msil",version="1.0.0.0"

ERROR: Line 9: The element clrClass appears as a child of element urn:schemas-microsoft-com:asm.v1^dependentAssembly which is not supported by this version of Windows.

問題是,dependentAssembly元素不應提供程序集的完整說明 - 僅用於指示參考。您必須爲該程序集提供單獨的組件清單文件,然後通過clrClass描述導出的COM類。這在this MSDN article中有更詳細的描述。

相關問題