Reg-Free COM doesn't work for me

I am trying to check if Reg-Free COM is not something we can use in our web application to make it easier to deploy legacy COM components. However, before I move on to looking at things like using it for Interop situations, I can't get a simple test to work. Here's what I did: -

1) Create a new VB ActiveX DLL project. Left all options at their defaults, except for enabling binary compatibility. Added a class with a simple "SayHello" method.
2) Create a new C # Console Application in Vs.NET 2008 (SP1). Install the cpu to x86 and add a link to my COM DLL.
3) Included "Isolated" for reference
4) Call my SayHello method from a C # console application - everything works.
5) Manually reinstall the COM dll using regsvr32 / u
6) Try running the console application again. The application crashes with a COM error because it cannot find the COM registration information. I can confirm that the manifest is present (inserted below)

I am running this on Vista 64Bit if it matters.

Thanks for any pointers.

<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity name="TestRegFreeCom.exe" version="1.0.0.0" processorArchitecture="x86" type="win32" />
  <file name="TestProject.dll" asmv2:size="20480">
    <hash xmlns="urn:schemas-microsoft-com:asm.v2">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>uIK8e9FAnH4SQwk6PRfrjdZHWuw=</dsig:DigestValue>
    </hash>
    <typelib tlbid="{08dcd362-63a1-424a-8c4e-e72dcda2a8e2}" version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
    <comClass clsid="{c540c43a-4d80-4c87-9091-dff664df0021}" tlbid="{08dcd362-63a1-424a-8c4e-e72dcda2a8e2}" progid="TestProject.Testy" />
  </file>
</assembly>

      

+1


source to share


3 answers


If you are referencing the .dll in your application, click the dll link referencing your project, look at the properties and set Isolated to TRUE.

This will include the DLL in your project and your application will use the copy of the .dll included in your project.

To see a working example of this kind:



http://archive.msdn.microsoft.com/SEHE

The .dll in question will need to be registered with the system where you will build the application to work properly.

+2


source


Your sample code is represented as the manifest for the DLL of the COM object. Do you have a manifest for the main program? It needs one that renders another object as a dependency.

In answering an earlier question on this question, my test was a C # program that used an old ActiveX control that came with VB5 / VB6. The phenomenon for my main program looked like this:

<?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.0.0.0" />
<dependency>
            <dependentAssembly>
                        <assemblyIdentity
                                    type="win32"
                                    name="MSFLXGRD.X"
                                    version="6.1.97.82" />
            </dependentAssembly>
</dependency>
</assembly>

      



The name attribute on dependAssembly / assemblyIdentity must match the name attribute in the manifest for the COM DLL. As you can see here, it doesn't have to be the actual filename.

Another possible problem, I see you don't have a comInterfaceExternalProxyStub element in your manifest. For a sample of this tag and a step-by-step guide on what else to do, see this article on MSDN: Activating COM Component Components Without Registration: A Step-by-Step Guide . Steps 6 and 7 talk about creating two manifestations.

+2


source


Thanks for the answer.

The added manifest is automatically generated from the .NET console application. The manifest is not generated for the COM DLL itself. I'll walk you through the walkthrough and see if it provides any answers.

0


source







All Articles