Search code examples
.netdeploymentvb6uacdll

vb6 and vb .net interop on vista 64 versus windows 7


I have written a .net dll that I can successfully call from vb6. Deployment to xp, vista 32, and vista 64 boxes have been working. It is not working on windows 7 64 bit. I cannot run regasm.exe /codebase name.dll on the end users machine because they are not admins.

Currently my app is deployed in the "c:\Program Files (x86)\application name" directory.


Solution

  • I'm using registration free COM to access the .NET interop assemblies.

    Basicly first you have to create assembly manifest with mt.exe and optionally re-sign strong names with sn.exe like this

    mt.exe -managedassemblyname:{Your_DLL} -nodependency -out:{Your_DLL}.manifest
    mt.exe -manifest {Your_DLL}.manifest -outputresource:%{Your_DLL};1
    sn -Ra {Your_DLL} {Your_PFX}
    

    Then reference this assembly manifest in your application manifest like this

    <dependency>
        <dependentAssembly>
            <assemblyIdentity name="{Your_DLL}" version="1.0.0.0" publicKeyToken="hash_here" processorArchitecture="x86" />
        </dependentAssembly>
    </dependency>
    

    where assemblyIdentity matches assemblyIdentity in assembly manifest of {Your_DLL}.

    On client machines both the VB6 executable and .NET dll must be in the same folder. No regasm and no GAC registration needed.

    I'm using UMMM tool to automate the manifest creation process but you can do it manually if it's a one time setup.