Search code examples
c#.netvb6interopregfreecom

Reg Free Com with VB6.exe on Windows 7


I have some .NET code I use from VB6 code. I have always developed this on an XP machine by creating a VB6.exe.manifest file that listed the dependent .NET assemblies.

For example, say my 2 .NET assemblies are Some.Assembly.A.dll and Some.Assembly.B.dll, here is what VB6.EXE.manifest looks like (I use version=1.1.0.0 below because that is the version I set on the .NET AssemblyVersion in AssemblyInfo.cs):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
   manifestVersion="1.0">
  <assemblyIdentity
              type = "win32"
              name = "client"
              version = "1.1.0.0" />
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
                  type="win32"
                  name="Some.Assembly.A"
                  version="1.1.0.0" />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
                  type="win32"
                  name="Some.Assembly.B"
                  version="1.1.0.0" />
    </dependentAssembly>
  </dependency>
</assembly>

Then, along with the DLLs in the same directory, I have the assemblies and their own manifest files. Here is an example "Some.Assembly.A.dll.manifest":

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
  manifestVersion="1.0">
  <assemblyIdentity
      type="win32"
      name="Some.Assembly.A"
      version="1.1.0.0" />
  <clrClass
      clsid="{F1234567-1234-1234-1234-123456789012}"
      progid="Some.Assembly.A.Class1"
      threadingModel="Both"
      name="Some.Assembly.A.Class1" >
  </clrClass>
  <file name = "Some.Assembly.A.dll" />
</assembly>

I also run tlbexp on referenced DLLs to create TLB files, and this is what I reference in my VB6 project file.

I want to move to a Windows 7 64 BIT machine. Using the same methods, when I hit the VB6 code that instantiates the .NET object on the WIN7 machine I get

"ActiveX Component Can't Create Object."

On XP, it succeeds. If I purposely misspell the Dependent assembly in VB6.EXE.manifest - on XP I get

"This application has failed to start because teh application configuration is incorrect. Reinstalling the application may fix this problem."

On WIN7, VB6 just loads. It's like it ignores the manifest on WIN7, so I can't load my .NET object using REG FREE methods on WIN7. If I regasm the DLL, everything works.
Any ideas on how to make VB6 work with reg free com on WIN7 (64 BIT)?


Solution

  • Have you tried simply installing & running VB6 in WinXP compatability mode?