none
how to register my com interop dll from winXP on a win7 workstation (64bit)? RRS feed

  • Question

  • I created a com interop dll in VS2008 on a winXP workstation which I use in Excel(2003) taking advantage of some .Net features.  It works fine on the XP machine.  I don't have VS2008 loaded on the win7 workstation, but it does appear that I have all the .Net frameworks (through 4.0) loaded on this win7 box.  When I try to register the dll on the win7 box -- using regsvr32 "C:\Code\...manipulator.dll"  -- I get this error message:

    How can I register my com interop dll on the win7 machine?

    Thanks


    Rich P

    • Moved by Bob Shen Tuesday, March 26, 2013 7:45 AM
    Wednesday, March 20, 2013 4:54 PM

Answers

All replies

  • OK, I tried register the .tlb file instead of the dll

    regsvr32 "C:\Code\...manipulator.tlb"

    and now I received this error message from win7

    If anyone has suggestions what I could try -- or if I need to create this on the win7 (64 bit) os, please advise.

    Thanks


    Rich P

    Wednesday, March 20, 2013 7:27 PM
  • I tried deploying an excel app which uses the com interop dll and the dll and tlb as required files using Click Once.  The part of the Excel app that did not use the dll worked fine (from Excel 2003 to Excel 2010)  but the dll still did not work.  It looks like I have no choice but to rewrite the dll on the win7 box (which means I now have to jump through some hoops to get VS2008 loaded on the win7 box - which I wanted to avoid).

    New question:  Will VS2008 create 64bit apps on a 64bit win7 machine?


    Rich P

    Wednesday, March 20, 2013 10:42 PM
  • Hi Rich P123,

    "How can I register my com interop dll on the win7 machine?"

     "Will VS2008 create 64bit apps on a 64bit win7 machine?"

    Please check below articles to see if they can help you.

    How to register .NET Assembly for COM Interop ?

    http://blogs.msdn.com/b/jigarme/archive/2008/04/28/how-to-register-net-assembly-for-com-interop.aspx

    Use Visual Studio to build 64-bit application

    http://blogs.msdn.com/b/tolong/archive/2007/03/21/use-visual-studio-to-build-64-bit-application.aspx

    Good day.


    Bob Shen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Bob Shen Friday, March 22, 2013 8:08 AM
    Friday, March 22, 2013 8:07 AM
  • Thank you for your reply.  I totally forgot about regasm.  I tried it per the articles in the links.  my .Net assembly from the winXP machine  did register succesfully on the win7 machine using regasm.  I started with a simple "Hello World" assembly.  I registered it with regasm on the winXP box and did a debug.print test in Excel (2003) - this worked fine on winXP.  HOWEVER, I registered a copy of the same assembly in the win7 box using regasm and it also registered successfully and created the .tlb file ...  But when I went to do a debug.print test in that Excel (2010) -- I did get intellisense on my .Net com interop object, but it errored out at the debug.print statement

    -----------------------------------------------------

    Dim o As New myHWtestDLL.HWtest '--intellisense worked fine here

    Debug.Print o.HelloWorld  '--this is just supposed to return the text "Hello World" -- intellisense worked find here also but erred out when I ran it -- here's the error message

    "Automation Error - the system cannot find the file specified"

    ---------------------------------------------------------

    In VS2008 on the winxp box - I set the Build Events Platform target for this assembly -- "Any CPU"  (64 bit or 32 bit).  Here's the sample code in my test assembly.  Is there anything I am missing so that this could run on win7?

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Runtime.InteropServices;

    namespace myHWtestDLL
    {
        [InterfaceType(ComInterfaceType.InterfaceIsDual)]
        [Guid("69e9621f-3449-429e-b8e1-a0be18d38f7d")]
        public interface iHWtest
        {
            [DispId(1)]
            string HelloWorld{get; }

        }

        [ComVisible(true)]
        [ClassInterface(ClassInterfaceType.None)]
        [Guid("9471f39e-3b9b-449d-832a-1b34004bbfa5")]
        [ProgId("myHWtestDLL.HWtest")]
        public class HWtest : iHWtest
        {
            public string HelloWorld
            {
                get { return "Hello Julius!"; }
            }

        }
    }


    Rich P

    Friday, March 22, 2013 10:26 PM
  • Hi Rich P123,

    You can try use Fuslogvw.exe to see if any assembly couldn't be loaded at run time.

    http://msdn.microsoft.com/en-us/library/e74a18c4.aspx


    Bob Shen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, March 25, 2013 10:33 AM
  • Thank you again for your reply.  I only have .Net 2.0 thru 4.0 loaded on this win7 machine.  I do not have Fuslogvw.exe -- which I believe comes with .Net 4.5. 

    In the meantime I tried the 32bit regasm and also tried the 64bit regasm.  The assembly does appear to register and I do get a .tlb file when I type this in the command prompt (from C:\windows\microsoft.net\framework64\v2.0.50727)

    regasm c:\1c\myHWtestDLL.dll /tlb:myHWtestDLL.tlb

    When I make a reference to the .tlb file in the Excel VBA editor -- I can see the .tlb file and I can even create an object with intellisense.  But when I try to run the basic "Hello World" method -- I get the error message "the specified file cannot be found" -- which is kind of meaningless.

    What to do next (before begging and pleasing to load VS2008 on this win7 machine) ?

    Thanks


    Rich P



    • Edited by Rich P123 Monday, March 25, 2013 7:06 PM
    Monday, March 25, 2013 7:00 PM
  • Hi Rich,

    >>I only have .Net 2.0 thru 4.0 loaded on this win7 machine.  I do not have Fuslogvw.exe -- which I believe comes with .Net 4.5. 

    You can found it this way: http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx 

    If you have Visual Studio installed on your computer: On the taskbar, click Start, click All Programs, click Visual Studio, click Visual Studio Tools, right-click Visual Studio Command Prompt, and then click Run as administrator from the shortcut menu.

    -or-

    If you have the Windows SDK installed on your computer: On the taskbar, click Start, click All Programs, click the folder for the Windows SDK, right-click Command Prompt (or CMD Shell), and then click Run as administrator from the shortcut menu.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 3, 2013 4:40 PM
    Moderator