C# DLL - COM Issues

Posted on 2011-10-25
Last Modified: 2013-12-16

I have no experince using COM at all. I am having issues trying to use my C# DLL in Access & Excel.

Have been trying to copy this example http://

I have followed all the steps. I have ticked the "Sign the assembly" box as well but when running the regasm I see an error message saying "Warning: Registering an unsigned assembly with /codebase. I found my GUID in the registry but it doesn't look right. Please refer to the word document for a more detailed explantion along with screen shots.

Thanks for any help,

Question by:mcs26
    LVL 43

    Expert Comment

    You say you are following the example code - have you actually tested the example code to see if it works correctly?

    Author Comment

    Hi Andy,

    Thanks for responding.

    Yeah I have followed it and it does kind of work. But the issue seems to be that I cannot register
    my dll properly using the regasm.

    When I declare the variable in Excel ObjSim as SimpleCalc.Calc the intellisense detects the Library and class. However looking in the object browser I cannot seem any of classes methods although the simple does give the correct answer when adding two numbers together. Though when 1st running the code in Excel it debugs (the message is in the word document on the original post) then If i re-run the code again with no changes this time it will work (so it does seem something is not wrong).

    So after reading it looks like I need to use the Regasm / codebase command. However it says my assembly is unregistered despite me ticking the "sign the assembly" in .Net. I
    LVL 43

    Expert Comment

    I'm not quite clear from your response.
    Does the sample code NOT give any problems you experience?  (Intellisense functions to show methods of the class, assembly is registered....)

    Author Comment

    Sorry Andy, appreicate its probably not that clear. Have you read the word document I attached with the original post, as this I believe explains it much better than I can on here as it has screen shots etc.

    I also see what your saying, there was no sample code I just tried copying the example myself, which partially works.
    LVL 29

    Accepted Solution

    You want to give the COM DLL a strong key name this allows the .NET framework to find the library anywhere on the system and works in tandem with the /codebase switch.

    Project > Project Properties > Signing Tab > Check mark "sign the assembly" in the drop down underneath choose "new.." and on the dialog that appears enter a key file name and un-check "protect my key file with a password"  Then re-compile your COM DLL

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now