• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 453
  • Last Modified:

C# DLL - COM Issues

Hi,

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://http://www.geeksengine.com/article/create-dll.html

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,

Mark
SimpleCalc.doc
0
mcs26
Asked:
mcs26
  • 2
  • 2
1 Solution
 
AndyAinscowCommented:
You say you are following the example code - have you actually tested the example code to see if it works correctly?
0
 
mcs26Author Commented:
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
0
 
AndyAinscowCommented:
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....)
0
 
mcs26Author Commented:
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.
0
 
nffvrxqgrcfqvvcCommented:
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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now