Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

c# - Including .NET assemblies in a VB6 manifest?

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

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

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.

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

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'

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is a short description how UMMM does it:

  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"
    
  2. 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
    
  3. 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>
    

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...