4

I'm trying to get the simplest Registration Free COM project to work in 64bit Windows7! The COM component is also the simplest vb.NET DLL that works fine from the VB6 EXE when its registered.

Can anyone suggest why the manifests are not working please?

I have already tried to update any VB6 internal Manifest with mt.exe but the general error indicates that there is no internal manifest in Project2.exe

The VB6 program (Project2.exe) manifest is....

    <assemblyIdentity name="Project2.exe" version="1.0.0.0" type="win32"    processorArchitecture="x86"/>

    <dependency>
     <dependentAssembly>
      <assemblyIdentity name="ClassLibrary1" version="1.0.0.0" type="win32"/>
     </dependentAssembly>
    </dependency>

    </assembly>

And the DLL (ClassLibrary1.dll) manifest is.....

    <assemblyIdentity name="ClassLibrary1" version="1.0.0.0" type="win32"/>

    <clrClass
       name="ClassLibrary1.Class1"
       clsid="{D9531C2A-3822-4222-8D45-BC507FCDF5F3}"
       progid="ClassLibrary1.Class1"
       threadingModel="Both"/>

    <file name="ClassLibrary1.tlb">
     <typelib
         tlbid="{DA8A00C1-1E14-4295-AEDE-F8F23DD8E43D}"
         version="1.0"
         helpdir=""
         flags="hasdiskimage"/>
    </file>

    </assembly>
StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
  • Chicken-and-egg problem. The EXE finds the DLL from the manifest. So the entries in your DLL manifest belong in the EXE manifest instead. – Hans Passant Nov 20 '12 at 23:13
  • I'm not sure that's the problem. Embedding library info in the application manifest is a shortcut, and one I'm not sure Microsoft has even documented anywhere. A separate assembly manifest is the more "normal" case. Even ancient (~2004) versions of the MMM utility used to create separate assembly manifests and they worked properly. – Bob77 Nov 21 '12 at 02:29
  • Are you missing the `` directive in the assembly manifest? – Bob77 Nov 21 '12 at 02:32
  • I tried the chicken and egg suggestion, even though its not that way in all the documentation I've seen, but the manifest is unsurprisingly rejected. – Richard Bridger Nov 21 '12 at 02:41
  • The directive is in the manifest, I didnt paste the code in by mistake.... – Richard Bridger Nov 21 '12 at 02:43
  • MSDN (How to: Configure .NET-Based Components for Registration-Free Activation ) suggests that I should embed the assembly manifest into the managed assemby, but its the first time I've seen that, it seems that every article on this has a different methodology!! – Richard Bridger Nov 21 '12 at 02:48
  • Hans, perhaps I am not understanding the chicken and egg suggestion, can you point to an example please? – Richard Bridger Nov 21 '12 at 03:41
  • Answer to this question might help: http://stackoverflow.com/questions/9164660/vb6-manifest-adding-tlb-com – wqw Nov 21 '12 at 10:06
  • Are the files saved as Unicode? Just because I've made that idiotic mistake myself once :) – MarkJ Nov 21 '12 at 12:29
  • Possible duplicate of [Including .NET assemblies in a VB6 manifest?](https://stackoverflow.com/questions/9164660/including-net-assemblies-in-a-vb6-manifest) – StayOnTarget Feb 08 '19 at 19:01

1 Answers1

2

The manifests are correct, assuming that the Ids are correct. So your problem is something else. What error message do you get?

I employ RegFree Com succesfully and it has saved me countless headaches once you have the manifests right. I do not embed them. I use Side-by-Side Manifest Maker from Maze software for this, they are very helpful, very much worth the investment. I pasted the application manifest and the manifest of one of the dll's to give you a working example.

Filename=MyVB6App.exe.Manifest (Note the .exe. tag)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity name="MyVB6App.exe" version="2.8.0.127" type="win32" processorArchitecture="x86"/>
<description>Built with: Side-by-Side Manifest Maker (3.7.1.4434) (x86)</description>

<dependency>
 <dependentAssembly>
  <assemblyIdentity name="MyNetComWrapper" version="1.0.24.0" type="win32" publicKeyToken="6ABF096D69195FE6"/>
 </dependentAssembly>
</dependency>

</assembly>

Filename=MyNetComWrapper.Manifest (Note the abscense of a .dll. tag)

<assemblyIdentity name="MyNetComWrapper" version="1.0.24.0" type="win32" publicKeyToken="6ABF096D69195FE6"/>

<description>Built with: Side-by-Side Manifest Maker (3.7.1.4434) (x86)</description>

<clrClass
   name="MyComNetWrapper.SomeClass"
   clsid="{A68F56A1-8425-3E06-BA83-856EC8422F5B}"
   progid="MyComNetWrapper.SomeClass"
   runtimeVersion="v4.0.30319"
   threadingModel="Both"/>
<clrClass
   name="MyComNetWrapper.SomeOtherClass"
   clsid="{D5156DAF-0421-36AE-84B6-5D915068B2DC}"
   progid="MyComNetWrapperc.SomeOtherClass"
   runtimeVersion="v4.0.30319"
   threadingModel="Both"/>

<file name="MyComNetWrapper.tlb">
 <typelib
     tlbid="{D189D056-66F1-4C01-8EB9-1F95BA11254A}"
     version="1.0"
     helpdir=""
     flags="hasdiskimage"/>
</file>

</assembly>
MarkJ
  • 30,070
  • 5
  • 68
  • 111
Dabblernl
  • 15,831
  • 18
  • 96
  • 148
  • Edited in a link to the Maze software product, that sounds useful. – MarkJ Nov 21 '12 at 12:30
  • Interesting answer, will look further at this. Though the .NET interop used in the example might confuse the OP since his question (I don't think) had anything to do with .NET assemblies. – tcarvin Nov 21 '12 at 12:39
  • @tcarvin Read the OP's question again then :-) – Dabblernl Nov 21 '12 at 13:17
  • Yep, I see it now that I've had some coffee – tcarvin Nov 21 '12 at 13:32
  • I did use the Maze software to generate manifests. Sadly the support from Maze just stopped after some initial help with our full app. Then I generated simplest possible VB6 project and VB.NET assemby DLL for this forum. – Richard Bridger Nov 21 '12 at 14:31
  • Is there anything that might be preventing the Registration Free COM from working? – Richard Bridger Nov 21 '12 at 14:32
  • Thanks I will try the example, and the error in VB6 when trying to create an object from the .NET class is 'Automation error' (-2146234341). The ID's are correct. – Richard Bridger Nov 21 '12 at 14:36
  • @RichardBridger "Automation Error" is not very helpful, but it does mean that the manifests are correct. you did put the manifests and the dll in beside the executable didn't you? Use Fuselogvw (http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.100).aspx), which comes with the Windows 7 SDK to troubleshoot the issue. – Dabblernl Nov 21 '12 at 18:19
  • 1
    OK, this answer did it..http://stackoverflow.com/questions/11469592/cannot-get-to-work-vb-net-dll-referenced-by-vb6-client-in-reg-free-scenario. – Richard Bridger Nov 21 '12 at 18:20
  • So an earlier CLR version was being used by VB6 programs on this computer. I'm hoping that CLR version 4 will always be present on XP, Windows 7 and 8 computers without having to install .NET framework with our installer?? (part reason for using Registration Free COM is to avoid using REGASM that comes with the framework!) – Richard Bridger Nov 21 '12 at 18:43
  • @RichardBridger You most certainly cannot count on the Net 4 Framework to be present on any other OS than Win 8. You must provide for a notification or include the installer for it in the setup of your application. The issue of having to avoid the use of Regasm has nothing to do with that. Do use RegFree Com, it spares you endless headaches with version conflicts when users can have different versions of your application on one computer. – Dabblernl Nov 21 '12 at 23:28
  • Thanks Dabblernl, I've just tested the manifests on an XP service pack 3 with dotNetFx40_Client_x86_x64.exe installed, but 'application configuration is incorrect' appears. Removing the application manifest allows it to run. Can this manifest work on XP?? – Richard Bridger Nov 23 '12 at 17:40
  • @RichardBridger Yes it can. The message means that you have filled in wrong version numbers or that the manifest resolver cannot find one of the dependent manifests. They must be in the same directory. – Dabblernl Nov 23 '12 at 18:22
  • I have checked each file in the installation (manifests,dll,exe), they get installed exactly same in XP as in Windows7. 'application configuration is incorrect' appears on XP but not on Windows7!? – Richard Bridger Nov 29 '12 at 17:52
  • you will have to sxstrace then to resolve this. Read this excellent article: http://blogs.msdn.com/b/junfeng/archive/2006/04/14/576314.aspx – Dabblernl Nov 29 '12 at 20:49
  • Yes thanks the article is good. Event Viewer showed 1 error for the sxs fail ID 59, 'Generate Activation Context'. But the Reference error message was: 'The operation completed successfully'. So no clue there! sxstrace.exe wont run in XP so I have maybe come to a dead end there. – Richard Bridger Nov 30 '12 at 19:39
  • The .NET DLL dependencies are located in the same folder as DLL and client. So are there any other possible causes for this manifest failiure on XP? – Richard Bridger Nov 30 '12 at 19:46
  • I am sorry, I have no more suggestions. SxSTrace and FusLogVW must help you out. – Dabblernl Nov 30 '12 at 20:01