none
Failed to use Registry COM Free to deploy .NET application which used both native com and .Net Com. RRS feed

  • Question

  • I want to use Registry COM Free to simplify product deployment. But I am failed to make the .Net COM assemblies registry free.

    my executable application is developed with .NET, it depend on a Native COM component, in the native COM component, another .NET COM instance is created by its progid through CreateObject() method.

    I used GenMan32.exe and mt.exe to generate manifest files for these COM. By my test, I found that all native com can by deployed with Reg-COM-Free, but after adding .Net com information into the manifest file, exception occurred when invoking .Net com from the Native COM. A strange thing is that if the executable application is developed with VB, then both .Net COM and Native COM can be deployed with Reg-COM-Free, no any exception. 

    I make a demo to show it : http://cid-8e2044f82a40fc2e.skydrive.live.com/embedicon.aspx/.Public/Com-Reg-Free^_Problem.zip
    In this demo, C# clients and VB clients use same manifest file and same VB and .NET COM. VB clients work well, but C# client failed.

    Any ideal on it?

    Regards,
    Yanhua
    Friday, September 25, 2009 7:12 AM

All replies

  • Your .zip file isn't usable.  The manifest will require <clrclass> elements to take care of the registration required by .NET ComVisible classes.  Was that done?

    Hans Passant.
    Friday, September 25, 2009 11:08 AM
    Moderator
  • Hans,

    I think i have <clrClass> section in the in manifest file of .NET com assebly, following is all manifest files in my test.

    1. Client_CSharp.exe.manifest --- .NET Entry application manifest file.
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <!-- Make My Manifest 0.7.300 -->
      <assemblyIdentity name="Client_CSharp" processorArchitecture="X86" type="win32" version="1.0.0.0" />
       <dependency>
            <dependentAssembly>
            <assemblyIdentity name="SideBySide_DotNet" version="1.0.0.0" processorArchitecture="msil">
            </assemblyIdentity>
            </dependentAssembly>
       </dependency>
       <dependency>
            <dependentAssembly>
            <assemblyIdentity name="SideBySide_VB" processorArchitecture="x86" type="win32" version="1.0.0.0">
            </assemblyIdentity>
            </dependentAssembly>
        </dependency>    
    </assembly>
    2. SideBySide_VB.manifest --- VB Com dll manifest file
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity name="SideBySide_VB" processorArchitecture="x86" type="win32" version="1.0.0.0">
    </assemblyIdentity> <file name="SideBySide_VB.dll" hashalg="SHA1"> <comClass clsid="{3BAB7D00-B37A-4291-9EA2-1FC7D85D0ACB}" tlbid="{D8FFFAEC-CFD6-40CA-A6A6-928AE0A2F2CF}"></comClass>
    <typelib tlbid="{D8FFFAEC-CFD6-40CA-A6A6-928AE0A2F2CF}" resourceid="1" version="1.0" helpdir="" flags="HASDISKIMAGE"></typelib>
    </file> <comInterfaceExternalProxyStub name="_VBCom" iid="{C9E2B94D-CA01-495E-8CDB-558AF1D44BE5}" tlbid="{D8FFFAEC-CFD6-40CA-A6A6-928AE0A2F2CF}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub> </assembly>
    3. SideBySide_DotNet.manifest  --- .NET COM assembly' manifest file
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
        <assemblyIdentity
            name="SideBySide_DotNet"
            version="1.0.0.0"
            processorArchitecture="MSIL" />
        <clrClass
            clsid="{61CEC9BB-5628-40DD-A283-56CA0B5676AE}"
            progid="DotNetCom.CoShowMessage"
            threadingModel="Both"
            name="DotNetCom.CoShowMessage"
            runtimeVersion="v2.0.50727">
        </clrClass>
        <file name="SideBySide_DotNet.dll">
        </file>
    </assembly>

    Both VB and .NET com manifest file are generated by MT.exe, and have been added into dll file's resource.
    VB Clients can work with the same manifest file with C# Clients except its assembly identification name.

    Regards,
    Yanhua
    Sunday, September 27, 2009 6:08 AM
  • The CLR doesn't allow using a [ComVisible] COM server that's written in a managed language through COM interop.  There is no need to, a .NET application has no trouble using a .NET assembly.  Just add a reference to the C# assembly in your app project.  It automatically uses the assembly that's deployed in the same folder as the .exe without help.

    Hans Passant.
    Sunday, September 27, 2009 1:14 PM
    Moderator
  • The Native COM will ask data from the .NET client application, that's why we develop a .NET com assembly as a bridge.  I am wondering whether Registry-Free-Com and Sxs can support our product deployed without any com registration? In MSDN, there are some articles talking about Reg-Free-Com, but no findings on our case. It is sound like that windows handling managed and un-managed application different when using side-by-side assemblies to create isolated application. Unfortunately, the difference is under the surface and without clear documents.

    Regards,
    Yanhua
    Monday, September 28, 2009 10:13 AM