在 VB6 清单中包含 .NET 程序集? [英] Including .NET assemblies in a VB6 manifest?

查看:19
本文介绍了在 VB6 清单中包含 .NET 程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 vb6 项目并想创建一个清单,因此不需要注册.

I am working on a vb6 project and want to create a manifest so no registering is required.

我使用 MMM(Make My Manifest)工具扫描您的 VB6 项目以查找 dll 依赖项并生成清单.

I use MMM (Make My Manifest) tool which scans your VB6 project for dll dependencies and generates the manifest.

但是,MMM 不包含 tlb 文件,并且我有一个用 .net 编写的 Client.dll 和 Client.tlb,它们已暴露给 COM 并在我的 VB6 程序中使用.

However, the MMM does not include tlb files, and I have a Client.dll and Client.tlb written in .net that which has been exposed to COM and used in my VB6 program.

我不建议你使用 Regasm,因为如果没有注册到注册表会很好.

I don't to you use Regasm as it would be nice if no register to the registry is done.

我尝试通过命令行中的 mt 工具生成单独的清单,'mt.exe -tlb:Client.tlb -dll:Client.dll -out:Client.manifest'

I tried to generate a seperate manifest for the via the mt tool in command line, 'mt.exe -tlb:Client.tlb -dll:Client.dll -out:Client.manifest'

然后我想我可以通过以下方式合并 2 个清单:'mt.exe -manifest program.exe.manifest client.manifest -out:program.exe.manifest'

Then I thought I could merge the 2 manifest via: 'mt.exe -manifest program.exe.manifest client.manifest -out:program.exe.manifest'

但是,当我运行程序时,我收到一个消息框,上面写着运行时错误 -2147220999 (800401f9): Automation error , Error in the Dll"

However, when I run the program I'm getting an message box that says ' Run-time error -2147220999 (800401f9): Automation error , Error in the Dll'

我在上面做的事情是否正确,任何人都有类似的经历,感谢任何帮助.

Am i doing things correctly above, anyone had similar experience, any help appreciated.

推荐答案

这里有一个简短的描述 UMMM 做到了:

Here is a short description how UMMM does it:

  1. 首先,对于 .Net dll,它会为此生成一个临时文件的清单

  1. First, for the .Net dll it generates a manifest to a temp file with this

mt.exe -nologo -managedassemblyname:"{dotnet_dll}" -nodependency -out:"{dotnet_dll}.manifest"

  • 然后将此清单作为 RT_MANIFEST 资源 2 嵌入到 .Net dll 中

  • Then embeds this manifest into .Net dll as RT_MANIFEST resource 2 with this

    mt.exe -nologo -manifest "{dotnet_dll}.manifest" -outputresource:"{dotnet_dll}";2
    

  • 最后通过从 .Net dll 清单中提取 assemblyIdentity 标签并将其添加到 dependencydependentAssembly 像这样标记

  • Finally references the .Net dll from the VB6 executable by extracting assemblyIdentity tag from .Net dll manifest and adding it to the reg-free manifest inside dependencydependentAssembly tag like this

    <dependency>
        <dependentAssembly>
            <assemblyIdentity name="PdfSigner" version="1.0.0.0" processorArchitecture="msil" />
        </dependentAssembly>
    </dependency>
    

  • 这样,汉斯提到的 clrClass 标记出现在 .Net dll 嵌入式清单中,而不是 VB6 可执行清单中.

    This way clrClass tags Hans mentions appear in the the .Net dll embedded manifest and not in the VB6 executable manifest.

    这篇关于在 VB6 清单中包含 .NET 程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆