开发者

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

开发者 https://www.devze.com 2022-12-20 10:35 出处:网络
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 o开发者_开发技巧n windows 7 64 bit.I cannot run regas

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 o开发者_开发技巧n 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.


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.


I solved this by running regasm with the /regfile option, and replacing HKLM with HKCU in the resulting .reg file.

If you need more precise instructions, let me know.


Deployment requires admin rights. It's supposed to fail in this case.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号